* Fix aplatir function
[TD_LISP.git] / course / functions.lsp
1 #!/usr/bin/env newlisp
2
3 ; function addition
4 ;(define (f x y) (+ x y))
5 ;(println (f 1 2))
6
7 ;(define f (lambda (x y) (+ x y)))
8 (setq f (lambda (x y) (+ x y)))
9 ;(set 'f (lambda (x y) (+ x y)))
10 (println (f 1 2))
11 (println ((lambda (x y) (+ x y)) 1 2))
12
13 (println (let ((x 1) (y 2)) (+ x y)))
14 (println ((lambda (x y) (+ x y)) 1 2))
15
16 (setq x 3 y 4)
17 (println "x="x" y="y)
18 (println ((lambda (y) (setq x 5 y 6) (+ x y)) 1 2))
19 (println "x="x" y="y)
20
21 (exit)