Up | Next | Prev | PrevTail | Tail |
The for eachform of the forstatement, designed for iteration down a list, is more general in symbolic mode. Its syntax is:
As in algebraic mode, if the keyword inis used, iteration is on each element of the list. With on, iteration is on the whole list remaining at each point in the iteration. As a result, we have the following equivalence between each form of for eachand the various mapping functions in Lisp:
do | collect | join | |
in | mapc | mapcar | mapcan |
on | map | maplist | mapcon |
Example: To list each element of the list (a b c):
for each x in ’(a b c) collect list x;
Up | Next | Prev | PrevTail | Front |