RosettaCodeData/Task/Catamorphism/Tailspin/catamorphism-2.tailspin
2023-07-01 13:44:08 -04:00

19 lines
261 B
Text

templates fold&{op:}
@: $(1);
$(2..last)... -> @: [$@, $] -> op;
$@ !
end fold
templates add
$(1) + $(2) !
end add
templates mul
$(1) * $(2) !
end mul
[1..5] -> fold&{op:add} -> '$;
' -> !OUT::write
[1..5] -> fold&{op:mul} -> '$;
' -> !OUT::write