From 5bd86ab1fa41dcace1ffa49c63853546d5ef079f Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Fri, 14 Dec 2012 22:39:45 +0000 Subject: [PATCH] Debug special form to write to console.log --- lispstrack.lisp | 6 ++++-- test.lisp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lispstrack.lisp b/lispstrack.lisp index 8af6781..a1d4add 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -78,6 +78,9 @@ body can access to the local environment through the variable env" (define-compilation quote (sexp) (lisp->js sexp)) +(define-compilation debug (form) + (format nil "console.log(~a)" (ls-compile form env))) + (defparameter *env* '()) (defparameter *env-fun* '()) @@ -86,7 +89,6 @@ body can access to the local environment through the variable env" ((symbolp sexp) (ls-lookup sexp env)) ((integerp sexp) (format nil "~a" sexp)) ((stringp sexp) (format nil " \"~a\" " sexp)) - ; list ((listp sexp) (let ((compiler-func (second (assoc (car sexp) *compilations*)))) (if compiler-func @@ -108,4 +110,4 @@ return " (ls-compile (car (last sexps)) env) ";")) (with-open-file (out "test.js" :direction :output :if-exists :supersede) (loop for x = (read in nil) while x - do (write-string (ls-compile x) out))))) + do (format out "~a;~%" (ls-compile x)))))) diff --git a/test.lisp b/test.lisp index 87240de..d555938 100644 --- a/test.lisp +++ b/test.lisp @@ -1,3 +1,5 @@ (lambda (x y) x) + +(debug "hola") -- 1.7.10.4