import { List } from 'purify-ts/List'List.at(0, [1, 2])List.at(2, [1, 2])➔➔Just(1)NothingList.head([1])List.head([])➔➔Just(1)NothingList.last([1, 2, 3])List.last([])➔➔Just(3)NothingList.tail([1, 2, 3])List.tail([1])List.tail([])➔➔➔Just([2, 3])Just([])NothingList.init([1, 2, 3])List.init([1])List.init([])➔➔➔Just([1, 2])Just([])NothingList.find(x => x > 5, [1,3,7,9])List.find(x => x > 5)([1,3,7,9])List.find(x => x > 10, [1,3,7,9])➔➔➔Just(7)Just(7)NothingList.findIndex(x => x > 5, [1,3,7,9])List.findIndex(x => x > 5)([1,3,7,9])List.findIndex(x => x > 10, [1,3,7,9])➔➔➔Just(2)Just(2)NothingList.uncons([1, 2, 3])List.uncons([1])List.uncons([])➔➔➔Just(Tuple(1, [2, 3]))Just(Tuple(1, []))NothingList.sum([])List.sum([1, 2, 3])➔➔06import { compare } from 'purify-ts/Function'
List.sort(compare, [1,100,-1])import { Order } from 'purify-ts/Function'
List.sort((x, y) => /* your own fn */, [0,102,-223])➔➔[-1, 1, 100]// Result depends on the returned Order enum value (Order.LT, Order.EQ or Order.GT)