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
The definition of functions stays the same [1]. It should not care, if the application is "partial" or not.
In the application, the user may add _ to the parameters they do not want to provide yet [2]. In this case a new function is returned, which accepts the underscored parameters [3].
This has the side effect, that for example specialized "default" functions can be created and passed directly to tag transformers [4].
// [1]
let add = fn (a, b) -> a + b;
let default = fn (value, default) -> if (!value) default else value;
// [2]
let add5 = add(5, _);
let add3 = add(_, 3);
let default_empty_array = default(_, []);
// [3]
let result = add3(2); // 5
let result = add5(2); // 7
// [4]
let numbers = #Array(of: #Int) :: default_empty_array
The text was updated successfully, but these errors were encountered:
First suggestion for a syntax:
The definition of functions stays the same [1]. It should not care, if the application is "partial" or not.
In the application, the user may add
_
to the parameters they do not want to provide yet [2]. In this case a new function is returned, which accepts the underscored parameters [3].This has the side effect, that for example specialized "default" functions can be created and passed directly to tag transformers [4].
The text was updated successfully, but these errors were encountered: