X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=lml.cl;h=5aea792905d74a3ee181936700e2c4b6584b14b3;hb=3ab8846a02d3541197a064b5bf9c254e80e3bce3;hp=6ad713cf9890c74339bdb98f80e1d7da6f14f730;hpb=0aef7827d849a0662274cb0eb6a532c2adf0165f;p=lml.git diff --git a/lml.cl b/lml.cl index 6ad713c..5aea792 100644 --- a/lml.cl +++ b/lml.cl @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Aug 2002 ;;;; -;;;; $Id: lml.cl,v 1.8 2002/09/16 09:45:50 kevin Exp $ +;;;; $Id: lml.cl,v 1.11 2002/09/16 10:02:14 kevin Exp $ ;;;; ;;;; This file, part of LML, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -204,7 +204,8 @@ (set-macro-character #\[ #'(lambda (stream char) (declare (ignore char)) - (let ((curr-string (make-array 1024 :fill-pointer 0 :adjustable t :element-type 'character)) + (let ((forms '()) + (curr-string (make-array 1024 :fill-pointer 0 :adjustable t :element-type 'character)) (got-comma nil)) (do ((ch (read-char stream t nil t) (read-char stream t nil t))) ((eql ch #\])) @@ -212,7 +213,7 @@ (if (eql ch #\() ;; Starting top-level ,( (progn - (lml-print curr-string) + (push `(lml-print ,curr-string) forms) (setf (fill-pointer curr-string) 0) (setq got-comma nil) (vector-push #\( curr-string) @@ -223,9 +224,13 @@ (return nil)) (vector-push-extend ch curr-string)) (vector-push-extend #\) curr-string) - (let ((result (eval (read-from-string curr-string)))) - (when result - (lml-print result))) + (let ((eval-string (read-from-string curr-string)) + (res (gensym))) + (push + `(let ((,res ,eval-string)) + (when ,res + (lml-print ,res))) + forms)) (setf (fill-pointer curr-string) 0)) ;; read comma, then non #\( char (progn @@ -239,7 +244,7 @@ (progn (setq got-comma nil) (vector-push-extend ch curr-string))))) - (lml-print curr-string)) - t)) + (push `(lml-print ,curr-string) forms) + `(progn ,@(nreverse forms)))))