RosettaCodeData/Task/Catamorphism/Zkl/catamorphism.zkl

4 lines
190 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02: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)