API / Js / List

List

Provide utilities for list.

t

RES
type t<'a> = list<'a>

length

RES
let length: t<'a> => int

cons

RES
let cons: ('a, t<'a>) => t<'a>

isEmpty

RES
let isEmpty: t<'a> => bool

hd

RES
let hd: t<'a> => option<'a>

tl

RES
let tl: t<'a> => option<t<'a>>

nth

RES
let nth: (t<'a>, int) => option<'a>

revAppend

RES
let revAppend: (t<'a>, t<'a>) => t<'a>

rev

RES
let rev: t<'a> => t<'a>

mapRev

RES
let mapRev: ((. 'a) => 'b, t<'a>) => t<'b>

map

RES
let map: ((. 'a) => 'b, t<'a>) => t<'b>

iter

RES
let iter: ((. 'a) => unit, t<'a>) => unit

iteri

RES
let iteri: ((. int, 'a) => unit, t<'a>) => unit

foldLeft

RES
let foldLeft: ((. 'a, 'b) => 'a, 'a, list<'b>) => 'a

Application order is left to right, tail-recurisve.

foldRight

RES
let foldRight: ((. 'a, 'b) => 'b, list<'a>, 'b) => 'b

Application order is right to left, tail-recursive.

flatten

RES
let flatten: t<t<'a>> => t<'a>

filter

RES
let filter: ((. 'a) => bool, t<'a>) => t<'a>

filterMap

RES
let filterMap: ((. 'a) => option<'b>, t<'a>) => t<'b>

countBy

RES
let countBy: ((. 'a) => bool, list<'a>) => int

init

RES
let init: (int, (. int) => 'a) => t<'a>

toVector

RES
let toVector: t<'a> => Js_vector.t<'a>

equal

RES
let equal: ((. 'a, 'a) => bool, list<'a>, list<'a>) => bool