Disabled external gits
This commit is contained in:
32
cs420-acc/l3-compiler/tests/expr-fun.l3
Normal file
32
cs420-acc/l3-compiler/tests/expr-fun.l3
Normal file
@@ -0,0 +1,32 @@
|
||||
;; In Emacs, open this file in -*- Scheme -*- mode
|
||||
|
||||
;; Test the "fun" expression
|
||||
|
||||
(@byte-write 73)
|
||||
|
||||
((fun (b) (@byte-write b)) 65)
|
||||
((fun (b)
|
||||
(@byte-write b)
|
||||
(@byte-write (@+ b 1)))
|
||||
66)
|
||||
(@byte-write ((fun (x) x) 68))
|
||||
|
||||
(let ((compose (fun (f g)
|
||||
(fun (x) (f (g x)))))
|
||||
(succ (fun (x) (@+ x 1)))
|
||||
(twice (fun (x) (@+ x x))))
|
||||
(@byte-write ((compose succ twice) 34)))
|
||||
|
||||
((fun (x y z) #u)
|
||||
(@byte-write 70)
|
||||
(@byte-write 71)
|
||||
(@byte-write 72))
|
||||
|
||||
(let* ((fact (fun (self x)
|
||||
(if (@= 0 x)
|
||||
1
|
||||
(@* x (self self (@- x 1))))))
|
||||
(fix (fun (f x)
|
||||
(f f x))))
|
||||
(if (@= (fix fact 5) 120)
|
||||
(@byte-write 73)))
|
Reference in New Issue
Block a user