RosettaCodeData/Task/Nested-function/Zkl/nested-function.zkl

9 lines
329 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
fcn makeList(separator){
counter:=Ref(1); // a container holding a one. A reference.
// 'wrap is partial application, in this case binding counter and separator
makeItem:='wrap(item){ c:=counter.inc(); String(c,separator,item,"\n") };
makeItem("first") + makeItem("second") + makeItem("third")
}
print(makeList(". "));