AjLisp in Javascript



Examples

(first '(a b))
((lambda (x) (+ x 1)) 1)
(define addx (x) (lambda (y) (+ x y))) (define add2 (addx 2)) (add2 3)
(define factorial (n) (if (equalp n 0) 1 (* n (factorial (- n 1))) ) ) (factorial 10)
(define map (fn lst) (if (nilp lst) nil (cons (fn (first lst)) (map fn (rest lst)) ) ) ) (map (lambda (x) (+ x 1)) '(1 2 3))
(.alert global "Hello, World")
(define document (.document global)) (define body (.body document)) (define newdiv (.createElement document "div")) (define newcontent (.createTextNode document "Hello, world")) (.appendChild newdiv newcontent) (.appendChild body newdiv)