From: David Vazquez Date: Sun, 16 Dec 2012 21:54:13 +0000 (+0000) Subject: New function: integer-to-string X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=709eb659914ade949a394c6ed7ad7cf0e1eaf707;p=jscl.git New function: integer-to-string --- diff --git a/lispstrack.lisp b/lispstrack.lisp index b637d10..6325f58 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -23,6 +23,15 @@ separator (join (cdr list) separator))))) +(defun integer-to-string (x) + (let ((digits nil)) + (while (not (= x 0)) + (push (mod x 10) digits) + (setq x (truncate x 10))) + (join (mapcar (lambda (d) (string (char "0123456789" d))) + digits) + ""))) + ;;;; Reader ;;; It is a basic Lisp reader. It does not use advanced stuff