Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference
decf
Type: |
- |
Lisp macro (closure) |
Source: |
- |
misc.lsp |
Syntax
- (decf symbol)
- symbol - a symbol with numerical value bound to it
returns - the new value of the symbol
In Nyquist, 'decf' is implemented as a Lisp macro:
(defmacro decf (symbol)
`(setf ,symbol (1- ,symbol)))
Description
The 'decf' macro is used for decrementing a numerical value of a variable.
1 is substracted to the number and the result is stored in the
variable. An error is signalled if the variable doesn't hold a
number.
Examples
(setq n 3) => 3
(decf n) => 2
n => 2
(decf n) => 1
(setq n 1.8) => 1.8
(decf n) => 0.8
(decf n) => -0.2
(decf n) => -1.2
n => -1.2
(setq n #\a) => #\a
(decf a) => error: bad argument type - #\a
Back to Top
Nyquist / XLISP 2.0 -
Contents |
Tutorials |
Examples |
Reference