RosettaCodeData/Task/100-doors/Common-Lisp/100-doors-2.lisp
2015-11-18 06:14:39 +00:00

9 lines
284 B
Common Lisp

(define-modify-macro toggle () not)
(defun 100-doors ()
(let ((doors (make-array 100)))
(dotimes (i 100)
(loop for j from i below 100 by (1+ i)
do (toggle (svref doors j))))
(dotimes (i 100)
(format t "door ~a: ~:[closed~;open~]~%" (1+ i) (svref doors i)))))