One Solution
(defun digits (n &optional (base 10))
(do ((digits '())) ((zerop n) digits)
(multiple-value-bind (quotient remainder) (truncate n base)
(push remainder digits)
(setf n quotient))))
Two Solution
(map 'list #'digit-char-p (prin1-to-string 15754548))
Or
(map 'list #'digit-char-p (format nil "~D" 15754548))
BTW:Thanks the help from Comp.Lang.Lisp
No comments:
Post a Comment