-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
questionFurther information is requestedFurther information is requested
Description
To achieve a friendly syntax for operators with parameters, we use a pattern where the library provides a function-that-returns-a-function.
> seq.map
[Function]
> seq.map(x => x * 2)
[Function]
We do not do this for operators without parameters.
> seq.toArray
[Function]
Some operators have parameters, but each has a default value:
> seq.unique
[Function]
> seq.unique()
[Function]
This makes operator usage somewhat inconsistent:
[ 1, 2, 3 ]
|> map(x => x * 2) // Parentheses to wrap parameters
|> unique() // Parentheses required because we have default arguments
|> toArray; // No parentheses, because this is not a function-that-returns-a-function
Perhaps it should look like this instead?
[ 1, 2, 3 ]
|> map(x => x * 2)
|> unique()
|> toArray(); // Parentheses required for all operators
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested