ch2_1_dolist
DOLIST
Classic LISP list iteration macro, implemented as special form in LabLISP. Expects at least one argument, which must be properly formed list: First element is a plain symbol, which will be the iterator variable. Second element must evaluate to proper list. There might be optional third element, the result form - single expression which will be evaluated after the looping is finished. If there is no result expression, the DOLIST
form returns NIL
.
After the initializer list, there can be any number of expressions (implicit PROGN
), which will be evaluated repeatedly in loop.
>(dolist (x '(a b c) T) (print x)) ; X will be bound to elements of the list A B C T ; result form
Note that the optional result form is evaluated in the context where the iterator symbol is still defined, but has NIL
value.
See also: DOTIMES
, RETURN
ch2_1_dolist.txt · Last modified: 2022/02/20 05:05 by admin