List
Provide utilities for list.
type t('a) = list('a);
let length: t('a) => int;
let cons: ('a, t('a)) => t('a);
let isEmpty: t('a) => bool;
let hd: t('a) => option('a);
let tl: t('a) => option(t('a));
let nth: (t('a), int) => option('a);
let revAppend: (t('a), t('a)) => t('a);
let rev: t('a) => t('a);
let mapRev: ((. 'a) => 'b, t('a)) => t('b);
let map: ((. 'a) => 'b, t('a)) => t('b);
let iter: ((. 'a) => unit, t('a)) => unit;
let iteri: ((. int, 'a) => unit, t('a)) => unit;
let foldLeft: ((. 'a, 'b) => 'a, 'a, list('b)) => 'a;
Application order is left to right, tail-recurisve.
let foldRight: ((. 'a, 'b) => 'b, list('a), 'b) => 'b;
Application order is right to left, tail-recursive.
let flatten: t(t('a)) => t('a);
let filter: ((. 'a) => bool, t('a)) => t('a);
let filterMap: ((. 'a) => option('b), t('a)) => t('b);
let countBy: ((. 'a) => bool, list('a)) => int;
let init: (int, (. int) => 'a) => t('a);
let toVector: t('a) => Js_vector.t('a);
let equal: ((. 'a, 'a) => bool, list('a), list('a)) => bool;