From 709eb659914ade949a394c6ed7ad7cf0e1eaf707 Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Sun, 16 Dec 2012 21:54:13 +0000 Subject: [PATCH] New function: integer-to-string --- lispstrack.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 1.7.10.4