Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Catamorphism/BCPL/catamorphism.bcpl
Normal file
15
Task/Catamorphism/BCPL/catamorphism.bcpl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
get "libhdr"
|
||||
|
||||
let reduce(f, v, len, seed) =
|
||||
len = 0 -> seed,
|
||||
reduce(f, v+1, len-1, f(!v, seed))
|
||||
|
||||
let start() be
|
||||
$( let add(x, y) = x+y
|
||||
let mul(x, y) = x*y
|
||||
|
||||
let nums = table 1,2,3,4,5,6,7
|
||||
|
||||
writef("%N*N", reduce(add, nums, 7, 0))
|
||||
writef("%N*N", reduce(mul, nums, 7, 1))
|
||||
$)
|
||||
Loading…
Add table
Add a link
Reference in a new issue