added userlib reduce function
Signed-off-by: Ava Hahn <ava@sunnypup.io>
This commit is contained in:
parent
3f75157fac
commit
4f6622730a
3 changed files with 28 additions and 1 deletions
|
|
@ -35,6 +35,7 @@
|
|||
(let ((test-val 0))
|
||||
(set (q test-val) 3)
|
||||
(eq? test-val 3))))
|
||||
|
||||
('prepend prepends to list'
|
||||
(quote
|
||||
(let ((list (2 3 4))
|
||||
|
|
@ -48,6 +49,12 @@
|
|||
(adder (lambda (x) (add 1 x))))
|
||||
(eq? (map adder list) (2 3 4)))))
|
||||
|
||||
('reduce function adds numbers'
|
||||
(quote
|
||||
(let ((list (1 2 3))
|
||||
(adder (lambda (x y) (add x y))))
|
||||
(eq? (reduce adder list) (add 1 2 3)))))
|
||||
|
||||
;; add more test cases here
|
||||
))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue