I've read that every form in Common Lisp returns something when evaluated. However, recently I've been playing with ASDF API and found a function that returns nothing:
CL-USER> (asdf:clear-output-translations)
; No value
How is this possible and why doesn't it return something like NIL
?
Common Lisp allows functions to return from 0
upto MULTIPLE-VALUES-LIMIT values. The constant MULTIPLE-VALUES-LIMIT
is 20
or larger.
The function VALUES allows one to return multiple values, including zero values.
Thus a common idiom is to use the form (values)
when a function has no useful return value and is just called for side effects. Also this usually causes the Lisp listener (aka REPL) to not print anything as return value, which can be useful for aesthetic reasons.
Note that variables only have a single value and that one can bind only exactly one value to a variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With