RosettaCodeData/Task/Variadic-function/Lambdatalk/variadic-function.lambdatalk

12 lines
243 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
{def foo
{lambda {:s} // :s will get any sequence of words
{S.first :s}
{if {S.empty? {S.rest :s}} then else {foo {S.rest :s}}}}}
-> foo
{foo hello brave new world}
-> hello brave new world
{foo {S.serie 1 10}}
-> 1 2 3 4 5 6 7 8 9 10