Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
7
Task/Catamorphism/ArkScript/catamorphism.ark
Normal file
7
Task/Catamorphism/ArkScript/catamorphism.ark
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
(import std.List :reduce :foldLeft)
|
||||
|
||||
(let sum (fun (a b) (+ a b)))
|
||||
|
||||
(assert (= 10 (reduce [1 2 3 4] sum)) "reduce array to 10")
|
||||
(assert (= 10 (foldLeft [1 2 3 4] 0 sum)) "fold array to 10")
|
||||
(assert (= 12 (foldLeft [1 2 3 4] 2 sum)) "fold array to 12 with initial value")
|
||||
Loading…
Add table
Add a link
Reference in a new issue