Use `false' like nil
authorDavid Vázquez <davazp@gmail.com>
Tue, 18 Dec 2012 22:34:24 +0000 (23:34 +0100)
committerDavid Vázquez <davazp@gmail.com>
Tue, 18 Dec 2012 22:34:24 +0000 (23:34 +0100)
lispstrack.lisp
test.lisp

index ba60596..b20ca47 100644 (file)
 
 (defun literal->js (sexp)
   (cond
-    ((null sexp) "undefined")
+    ((null sexp) "false")
     ((integerp sexp) (integer-to-string sexp))
     ((stringp sexp) (concat "\"" sexp "\""))
     ((symbolp sexp) (concat "{name: \"" (symbol-name sexp) "\"}"))
   (concat "(Math.floor(" (ls-compile x env fenv) "))"))
 
 (define-compilation null (x)
-  (concat "(" (ls-compile x env fenv) "== undefined)"))
+  (concat "(" (ls-compile x env fenv) "== false)"))
 
 (define-compilation cons (x y)
   (concat "{car: " (ls-compile x env fenv) ", cdr: " (ls-compile y env fenv) "}"))
index 9f58cf2..560a255 100644 (file)
--- a/test.lisp
+++ b/test.lisp
     (while (and ch (whitespacep ch))
       (%read-char stream)
       (setq ch (%peek-char stream)))))
+
+(defun terminalp (ch)
+  (or (null ch) (whitespacep ch) (char= #\) ch) (char= #\( ch)))
+
+