Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
--- /dev/null
+#!/usr/bin/env newlisp
+
+; function addition
+(define (f x y) (+ x y))
+(println (f 1 2))
+
+(define f (lambda (x y) (+ x y)))
+(setq f (lambda (x y) (+ x y)))
+;(set 'f (lambda (x y) (+ x y)))
+(println (f 1 2))
+(println ((lambda (x y) (+ x y)) 1 2))
+
+(exit)
;(println (last '()))
(define (list-length a-list)
- (if a-list
- (+ 1 (list-length (rest a-list)))
- 0))
+ (if a-list
+ (+ 1 (list-length (rest a-list)))
+ 0))
(println (list-length L))
+(println (length L))
+
+type list ::= empty-list | first * list
+
+(setq x 1)
+(println (+ x 1))
+
+(set 'x 1 'y 2)
+(let ((x 3) (y 4))
+ (println x)
+ (println (list x y)))
+(println "x="x" y="y)
+
+(setq x 3 y 4)
+(let ((x 1) (y 2))
+ (println "x="x" y="y))
+(println "x="x" y="y)
+
+(setq x 3 y 4)
+(let ((y 2))
+ (setq x 5 y 6)
+ (println "x="x" y="y))
+(println "x="x" y="y)
+
(exit)