Catamorphism: Difference between revisions

Content added Content deleted
Line 375: Line 375:


<lang rebol>; find the sum, with seed:0 (default)
<lang rebol>; find the sum, with seed:0 (default)
print fold [1 2 3 4] => (+)
print fold [1 2 3 4] => add


; find the product, with seed:1
; find the product, with seed:1
print fold [1 2 3 4] .seed:1 => (*)</lang>
print fold [1 2 3 4] .seed:1 => mul</lang>


{{out}}
{{out}}
Line 384: Line 384:
<pre>10
<pre>10
24</pre>
24</pre>



=={{header|BASIC}}==
=={{header|BASIC}}==