A component based functional template language

add explicit currying to function calls #7

Open t.ewert.foo
Open opened by t.ewert.foo

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);

// [3]
let result = add3(2); // 5
let result = add5(2); // 7

// [4]
let numbers = #Array(of: #Int) :: default(_, [])
Sign up or Sign in to add to the discussion.