From be0e560b524c25392d87b2226571052adf3fd5ae Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Sun, 16 Dec 2012 03:45:41 +0000 Subject: [PATCH] Symbols --- lispstrack.lisp | 6 ++++++ test.lisp | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lispstrack.lisp b/lispstrack.lisp index d3771fe..23bee21 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -124,6 +124,7 @@ ((null sexp) "undefined") ((integerp sexp) (format nil "~a" sexp)) ((stringp sexp) (format nil "\"~a\"" sexp)) + ((symbolp sexp) (format nil "{name: \"~a\"}" (symbol-name sexp))) ((consp sexp) (concat "{car: " (literal->js (car sexp)) ", cdr: " @@ -183,6 +184,11 @@ (define-compilation cdr (x) (concat "(" (ls-compile x env fenv) ").cdr")) +(define-compilation symbol-name (x) + (concat "(" (ls-compile x env fenv) ").name")) + + + (defmacro with-eval-when-compilation (&body body) `(setq *eval-when-compilations* (concat *eval-when-compilations* (progn ,@body)))) diff --git a/test.lisp b/test.lisp index 4b87743..4b6e015 100644 --- a/test.lisp +++ b/test.lisp @@ -40,6 +40,14 @@ (incf x) (debug x) +;;; Conses +(debug (cons 1 2)) +(debug (car (cons 1 2))) +(debug (cdr (cons 1 2))) + +;;; Symbols +(debug (symbol-name 'foo)) +(debug (symbol-name 'foo-bar)) ;;; &rest lambda-list @@ -47,11 +55,7 @@ (debug (lambda (x y &rest z) z)) (debug (lambda (x y &rest z) x)) -;;; Conses -(debug (cons 1 2)) -(debug (car (cons 1 2))) -(debug (cdr (cons 1 2))) - +;; (debug (foo)) ;; (eval-when-compile ;; (%compile-defmacro 'defun -- 1.7.10.4