RosettaCodeData/Task/Catamorphism/Maple/catamorphism-1.maple

9 lines
261 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
> nums := seq( 1 .. 10 );
nums := 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
> foldl( `+`, 0, nums ); # compute sum using foldl
55
> foldr( `*`, 1, nums ); # compute product using foldr
3628800