You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
To achieve a friendly syntax for operators with parameters, we use a pattern where the library provides a function-that-returns-a-function.
We do not do this for operators without parameters.
Some operators have parameters, but each has a default value:
This makes operator usage somewhat inconsistent:
Perhaps it should look like this instead?
The text was updated successfully, but these errors were encountered: