(loop for i in *random*
counting (evenp i) into evens
counting (oddp i) into odds
summing i into total
maximizing i into max
minimizing i into min
finally (return (list min max total evens odds)))
Or, more realistic example from a project I'm currently working on:
(loop
with entities = (%get-entities-for-rendering x (+ x w) y (+ y h))
for (ent-x ent-y ent-fg ent-char) in entities
for realx = (+ cx (- ent-x x))
for realy = (+ cy (- ent-y y))
do
(tcod:console-set-char-foreground console realx realy ent-fg)
(tcod:console-set-char console
realx
realy
ent-char))
Common Lisp's loop can do crazy amount of things in a compact form, though there are things that are missing, and the whole thing isn't extensible (though there are library-provided alternatives like iterate that are better in this aspect).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Or, more realistic example from a project I'm currently working on:
Common Lisp's loop can do crazy amount of things in a compact form, though there are things that are missing, and the whole thing isn't extensible (though there are library-provided alternatives like iterate that are better in this aspect).