February 2019
Beginner to intermediate
180 pages
4h 4m
English
Some of the Belt standard library functions have a U suffix, such as this one:
Belt.List.makeBy
You can see the suffix here:
Belt.List.makeByU
The U suffix stands for uncurried. Before going further, let's define currying.
In Reason, every function accepts exactly one argument. This seems to contradict many of our earlier examples:
let add = (a, b) => a + b;
The preceding add function looks as if it accepts two arguments, but it is actually just syntactic sugar for the following:
let add = a => b => a + b;
The add function accepts a single argument, a, which returns a function that accepts a single argument, b, and then returns the result of a + b.
In Reason, both versions are valid and have the same compiled output. In JavaScript, ...
Read now
Unlock full access