February 2019
Beginner to intermediate
180 pages
4h 4m
English
The makeBy function is like the make function, except it accepts a function used to determine the value of each item given the item's index.
The type of the makeBy function is as follows:
(int, int => 'a) => Belt.List.t('a)
We can use it to create a list of ten items, where each item is equal to its index:
let list = Belt.List.makeBy(10, i => i);
Read now
Unlock full access