fork download
  1. (defun lotto-column ()
  2. "Return 6 unique numbers as a list"
  3. (let ((nums nil))
  4. (loop
  5. (when (= (list-length nums) 6)
  6. (return))
  7. (let ((val nil))
  8. (loop
  9. (setf val (random 42))
  10. (when (not (numberp (position val nums)))
  11. (return)))
  12. (push val nums)))
  13. nums))
  14.  
  15. (defun lotto-columns (x)
  16. (dotimes (i x)
  17. (dolist (num (lotto-column))
  18. (format t "[~2a] " num))
  19. (format t "~%")))
  20.  
  21.  
  22. (lotto-columns 4)
  23.  
Success #stdin #stdout 0.01s 25192KB
stdin
Standard input is empty
stdout
[37] [35] [33] [5 ] [31] [28] 
[36] [39] [16] [31] [26] [4 ] 
[28] [24] [18] [17] [33] [25] 
[12] [8 ] [41] [7 ] [13] [28]