Skip to content

Instantly share code, notes, and snippets.

@Idorobots
Created July 20, 2012 16:31
Show Gist options
  • Save Idorobots/3151704 to your computer and use it in GitHub Desktop.
Save Idorobots/3151704 to your computer and use it in GitHub Desktop.
Common Lisp LOOP example and output
(let ((random (loop with max = 500
for i from 0 to max
collect (random max))))
(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 (format t "Stats: ~A"
(list min max total evens odds))))
Stats: (0 499 120808 261 240)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment