aboutsummaryrefslogtreecommitdiff
path: root/files/test-lambda.l
blob: e088ad6fb81a4e6a98b3eedb6726a8e5635a8bdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(define make-add (lambda (a) (lambda (b) (+ a b))))
(define add4 (make-add 4))
(add4 5)

'(a b ,((lambda (a) '(test . ,a)) 69) c d)

(define fib (lambda (c) (fib-rec 0 1 0 c)))
(define fib-rec (lambda (a b n c)
                  (if (= n c)
                      b
                      (fib-rec b (+ a b) (+ n 1) c))))

(define do (lambda (c f) (do-rec f 0 0 c)))

(define do-rec (lambda (f r n c)
                 (if (= n c) r
                     (do-rec f (f n) (+ n 1) c))))

;; comment
;; another comment
;; fib(13)
(do 10 (lambda (n) (display (fib n)))) ; comment