Function spread argument syntax
WilliamRagstad opened this issue · comments
William commented
Functions have a fixed set of defined parameters, but in some cases we might want to give a function any amount of arguments.
There is therefore a need for some argument spread syntax similar to JavaScript or the params
keyword in C#.
This would functions with the spread syntax have a minimum airity but no maximum, casting all arguments after the one with the params keyword or spread syntax to a list:
let greet = fn(greeting, ...people) => greeting + fold(fn(result, person) => result + ", " + person, "", people)
greet("Hello", "John", "Peter", "Mike") // "Hello, John, Peter, Mike"