-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathex1.41-procedure-double.scm
35 lines (28 loc) · 1 KB
/
ex1.41-procedure-double.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(define (inc x)
(+ x 1))
(define (double g)
(lambda (x) (g (g x))))
((double inc ) 4) ; 6
(((double double) inc) 5)
(( (double double) inc) 5)
; | |
( ((lambda (x) (double (double x))) inc) 5)
; | |
( (double (double inc)) 5)
; | |
( (double (lambda (x) (inc (inc x)))) 5)
; | |
( (lambda (x) (inc (inc (inc (inc x))))) 5)
(( (double (double double)) inc ) 5)
(( (double (double double) ) inc ) 5)
; | |
(( (double (lambda (x) (double (double x))) ) inc ) 5)
; | |
(( (lambda (x) (double (double (double (double x ))))) inc) 5)
;| |
( (double (double (double (double inc)))) 5)
; | |
( (double (double (double (lambda (x) (inc (inc x)))) )) 5)
; | |
( (double (double (lambda (x) (inc (inc (inc (inc x))))) )) 5)
; ....