-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathapply.scm
17 lines (14 loc) · 898 Bytes
/
apply.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(print (apply (lambda (a b c) (list a b c)) '(1 2 3)))
(print (apply (lambda (a b c) (list a b c)) 1 '(2 3)))
(print (apply (lambda (a b c) (list a b c)) 1 2 '(3)))
(print (apply (lambda (a b c) (list a b c)) 1 2 3 '()))
(print (apply (lambda (a b . c) (list a b c)) '(1 2 3 4)))
(print (apply (lambda (a b . c) (list a b c)) 1 '(2 3 4)))
(print (apply (lambda (a b . c) (list a b c)) 1 2 '(3 4)))
(print (apply (lambda (a b . c) (list a b c)) 1 2 3 '(4)))
(print (apply (lambda (a b . c) (list a b c)) 1 2 3 4 '()))
(print (values-apply (call/cc (λ (k) (apply k 1 null))) (lambda x x)))
(print (values-apply (call/cc (λ (k) (apply k 1 2 null))) (lambda x x)))
(print (values-apply (call/cc (λ (k) (apply k 1 2 '(3)))) (lambda x x)))
(print (values-apply (call/cc (λ (k) (apply k 1 2 '(3 4)))) (lambda x x)))
; (print (apply (lambda x x) 42)) ;; <- don't know yet if this is allowed