Arguments
Documentation for the Arguments type.
Captured arguments to a function.
Argument Sinks
Like built-in functions, custom functions can also take a variable number of arguments. You can specify an argument sink which collects all excess arguments as ..sink. The resulting sink value is of the arguments type. It exposes methods to access the positional and named arguments.
Spreading
Inversely to an argument sink, you can spread arguments, arrays and dictionaries into a function call with the ..spread operator:
Constructor
Construct spreadable arguments in place.
This function behaves like let args(..sink) = sink.
#arguments(
arguments
) -> argumentsParameters
Prop
Type
Methods
The number of arguments, positional or named.
Returns the positional argument at the specified index, or the named argument with the specified name.
If the key is an integer, this is equivalent to first calling pos and then array.at. If it is a string, this is equivalent to first calling named and then dictionary.at.
#arguments.at(
key,
default: any
) -> anyParameters
Prop
Type
Returns the captured positional arguments as an array.
Returns the captured named arguments as a dictionary.
Produces a new arguments with only the arguments for which the value passes the test.
#arguments.filter(
test
) -> argumentsParameters
Prop
Type
Produces a new arguments by transforming each argument value with the passed function.
#arguments.map(
mapper
) -> argumentsParameters
Prop
Type