There are two type of lisp coders. Those that love the loop
macro and those
that don’t.
I’m one of the former.
Take this beautiful construction:
(loop for item in mylist
collect (first item) into known-keys
maximize (second item) into big
minimize (second item) into small
finally (return (values known-keys big small)))
Even not knowing what mylist
was you could guess that known-keys
would be
the collection of all the first elements of item
, and big
and small
would
be the largest and smallest values in the second part of item
.
If I told you that mylist
was a list of items that had two elements, viz.
((a . 3) (b . 2) (c . 1))
You’d be able to guess that the result would be something like
(a b c)
3
1
loop
is easy to read and reflects the true strength of common lisp - DSLs make
readable (and performant) code easy.