User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:macros:incf [2019/12/05 03:00]
cl:macros:incf [2019/12/07 02:00] (current)
Line 1: Line 1:
 +====== Macro INCF, DECF ======
 +
 +====Syntax====
 +  * **incf** //place [delta-form]//​ → //​new-value// ​
 +  * **decf** //place [delta-form]//​ → //​new-value//​
 +
 +====Arguments and Values====
 +  * //place// - a //​[[CL:​Glossary:​place]]//​.
 +  * //​delta-form//​ - a //​[[CL:​Glossary:​form]]//;​ evaluated to produce a //delta//. The default is ''​1''​.
 +  * //delta// - a //​[[CL:​Glossary:​number]]//​.
 +  * //​new-value//​ - a //​[[CL:​Glossary:​number]]//​.
 +
 +====Description====
 +**incf** and **decf** are used for incrementing and decrementing the //​[[CL:​Glossary:​value]]//​ of //place//, respectively.
 +
 +The //delta// is added to (in the case of **incf**) or subtracted from (in the case of **decf**) the number in //place// and the result is stored in //place//.
 +
 +Any necessary type conversions are performed automatically.
 +
 +For information about the //​[[CL:​Glossary:​evaluation]]//​ of //​[[CL:​Glossary:​subform|subforms]]//​ of //places//, see section {\secref\GenRefSubFormEval}.
 +
 +====Examples====
 +<​blockquote>​
 +([[CL:​Macros:​defparameter]] *n* 0) *n*
 +(incf n) <r>1 </r>
 +*n* <r>1 </r>
 +(decf *n* 3) <r>-2 </r>
 +*n* <r>-2 </r>
 +(decf *n* -5) <r>3 </r>
 +(decf *n*) <r>2 </r>
 +(incf *n* 0.5) <​r>​2.5 </r>
 +(decf *n*) <​r>​1.5 </r>
 +*n* <​r>​1.5 </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +//place// is modified.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Functions:​math-add|Function +]]**
 +  * **[[CL:​Functions:​math-subtract|Function -]]**
 +  * **[[CL:​Functions:​math-one-plus|Function 1+]]**
 +  * **[[CL:​Functions:​math-one-minus|Function 1-]]**
 +  * **[[CL:​Macros:​setf|Macro SETF]]**
 +
 +====Notes====
 +None.
 +
 +\issue{PUSH-EVALUATION-ORDER:​FIRST-ITEM}