RosettaCodeData/Task/Catamorphism/Zkl/catamorphism.zkl

4 lines
190 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
T("foo","bar").reduce(fcn(p,n){p+n}) //--> "foobar"
"123four5".reduce(fcn(p,c){p+(c.matches("[0-9]") and c or 0)}, 0) //-->11
File("foo.zkl").reduce('+(1).fpM("0-"),0) //->5 (lines in file)