Skip to content

Function spread argument syntax #16

@WilliamRagstad

Description

@WilliamRagstad

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsyntaxLanguage design related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions