From 617091e424b37647703a65cee078b417f946688e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Sun, 20 Jan 2013 16:11:56 +0000 Subject: [PATCH] Printer for arrays --- ecmalisp.lisp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ecmalisp.lisp b/ecmalisp.lisp index 03f2988..a02f3f6 100644 --- a/ecmalisp.lisp +++ b/ecmalisp.lisp @@ -289,7 +289,7 @@ ((stringp seq) (string-length seq)) ((arrayp seq) - (get "length" seq)) + (oget seq "length")) ((listp seq) (list-length seq)))) @@ -634,6 +634,12 @@ (defun mapconcat (func list) (join (mapcar func list))) +(defun vector-to-list (vector) + (let ((list nil) + (size (length vector))) + (dotimes (i size (reverse list)) + (push (aref vector i) list)))) + ;;; Like CONCAT, but prefix each line with four spaces. Two versions ;;; of this function are available, because the Ecmalisp version is ;;; very slow and bootstraping was annoying. @@ -726,6 +732,8 @@ (prin1-to-string (car last)) (concat (prin1-to-string (car last)) " . " (prin1-to-string (cdr last))))) ")")) + ((arrayp form) + (concat "#" (prin1-to-string (vector-to-list form)))) ((packagep form) (concat "#")))) -- 1.7.10.4