RosettaCodeData/Task/Catamorphism/Zkl/catamorphism.zkl
2017-09-25 22:28:19 +02:00

3 lines
190 B
Text

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)