Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No value returned by Common Lisp function

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?

like image 846
Mark Karpov Avatar asked Aug 15 '14 06:08

Mark Karpov


1 Answers

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.

like image 75
Rainer Joswig Avatar answered Sep 28 '22 05:09

Rainer Joswig