X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lispstrack.lisp;h=7bb69452c0521fee1feef8b69837cafb17f7e819;hb=303beabd731556a15a88141af6e84808c8ed425f;hp=c8bb3c5858ada4bd32cb8ec69417c3661c7a9628;hpb=6c88585c829e2554f8533369dbef3eea01a3edeb;p=jscl.git diff --git a/lispstrack.lisp b/lispstrack.lisp index c8bb3c5..7bb6945 100644 --- a/lispstrack.lisp +++ b/lispstrack.lisp @@ -14,12 +14,10 @@ ((not ,condition)) ,@body)) - #+common-lisp (defun concat-two (s1 s2) (concatenate 'string s1 s2))) -(defvar *newline* " -") +(defvar *newline* (string (code-char 10))) (defun concat (&rest strs) (!reduce (lambda (s1 s2) (concat-two s1 s2)) @@ -387,6 +385,12 @@ (define-compilation = (x y) (concat "((" (ls-compile x env fenv) ") == (" (ls-compile y env fenv) "))")) +(define-compilation mod (x y) + (concat "((" (ls-compile x env fenv) ") % (" (ls-compile y env fenv) "))")) + +(define-compilation floor (x) + (concat "(Math.floor(" (ls-compile x env fenv) "))")) + (define-compilation null (x) (concat "(" (ls-compile x env fenv) "== undefined)")) @@ -408,7 +412,7 @@ (define-compilation eq (x y) (concat "(" (ls-compile x env fenv) " === " (ls-compile y env fenv) ")")) -(define-compilation code-char (x) +(define-compilation string (x) (concat "String.fromCharCode( " (ls-compile x env fenv) ")")) (define-compilation char (string index)