RosettaCodeData/Task/Four-is-magic/Common-Lisp/four-is-magic.lisp
2025-02-27 18:35:13 -05:00

10 lines
530 B
Common Lisp

(defun integer-to-text (int)
(format nil "~@(~A~)" (with-output-to-string (out)
(loop for n = int then (length c)
for c = (format nil "~R" n)
while (/= n 4)
do (format out "~A is ~R, " c (length c))
finally (format out "four is magic.")))))
(loop for n
in '( -1 0 1 2 3 4 5 6 7 8 9 11 21 1995 1000000 1234567890 1100100100100 )
do (print (integer-to-text n)))