mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 18:57:48 +01:00
rename tests
This commit is contained in:
20
clitests/decorate.test.psil
Normal file
20
clitests/decorate.test.psil
Normal file
@@ -0,0 +1,20 @@
|
||||
(define (decorate f g)
|
||||
(lambda (x) (g (f x)))
|
||||
)
|
||||
|
||||
(define (fold op acc l)
|
||||
(if (nil? l)
|
||||
acc
|
||||
(op (car l) (fold op acc (cdr l)))
|
||||
)
|
||||
)
|
||||
|
||||
(define (plus a b)
|
||||
(+ a b)
|
||||
)
|
||||
|
||||
((decorate (lambda (x) (+ x 1)) (lambda (x) (+ x 2))) 1)
|
||||
((decorate (lambda (lst) (fold plus 0 lst)) (lambda (x) (* x x))) (quote(1 2 3)))
|
||||
((decorate (lambda (lst) (fold plus 0 lst)) (lambda (x) (/ x 2))) (quote(1 2 3)))
|
||||
((decorate (lambda (lst) (fold plus 0 lst)) (lambda (x) (= x 0))) (nil))
|
||||
((decorate (lambda (lst) (fold plus 0 lst)) (lambda (x) (= x 0))) (quote(1)))
|
||||
Reference in New Issue
Block a user