RosettaCodeData/Task/Catamorphism/11l/catamorphism.11l

5 lines
164 B
Plaintext

print((1..3).reduce((x, y) -> x + y))
print((1..3).reduce(3, (x, y) -> x + y))
print([1, 1, 3].reduce((x, y) -> x + y))
print([1, 1, 3].reduce(2, (x, y) -> x + y))