(concat "((" (ls-compile x env fenv) ") == (" (ls-compile y env fenv) "))"))
(define-compilation cons (x y)
- (concat "(new Cons("y", " x "))"))
+ (concat "{car: " (ls-compile x env fenv) ", cdr: " (ls-compile y env fenv) "}"))
(define-compilation car (x)
- (concat "(x.car)"))
+ (concat "(" (ls-compile x env fenv) ").car"))
(define-compilation cdr (x)
- (concat "(x.cdr)"))
+ (concat "(" (ls-compile x env fenv) ").cdr"))
(defmacro with-eval-when-compilation (&body body)
`(setq *eval-when-compilations*
(with-open-file (out output :direction :output :if-exists :supersede)
(loop
for x = (read in nil) while x
- for compilation = (ls-compile x)
+ for compilation = (ls-compile-toplevel x)
when compilation do (write-line (concat compilation "; ") out)))))
+++ /dev/null
-//
-
-function Symbol(name){
- this.name = name;
-}
-
-function Cons(car, cdr){
- this.car = car;
- this.cdr = cdr;
-}
-
-
-
-console.log('Running test.js...');
(defmacro incf (x)
(list 'setq x (list '+ 1 x)))
+(eval-when-compile
+ (%compile-defvar 'x))
+
(setq x 10)
(incf x)
(debug x)
(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)))
+
+
;; (eval-when-compile
;; (%compile-defmacro 'defun
;; (lambda (name args &rest body)