UNPKG

4.29 kBTypeScriptView Raw
1export declare function setEquals(equals: (a: any, b: any) => boolean): void;
2export declare type Sizes = number[] | undefined;
3export declare class Node {
4 sizes: Sizes;
5 array: any[];
6 constructor(sizes: Sizes, array: any[]);
7}
8export declare function nth<A>(index: number, l: List<A>): A;
9export declare class List<A> {
10 bits: number;
11 offset: number;
12 length: number;
13 root: Node | undefined;
14 suffix: A[];
15 prefix: A[];
16 constructor(bits: number, offset: number, length: number, root: Node | undefined, suffix: A[], prefix: A[]);
17 [Symbol.iterator](): Iterator<A>;
18}
19export declare function prepend<A>(value: A, l: List<A>): List<A>;
20export declare function append<A>(value: A, l: List<A>): List<A>;
21export declare function list<A>(...elements: A[]): List<A>;
22export declare function pair<A>(first: A, second: A): List<A>;
23export declare function empty(): List<any>;
24export declare function repeat<A>(value: A, times: number): List<A>;
25export declare function length(l: List<any>): number;
26export declare function first<A>(l: List<A>): A | undefined;
27export declare function last<A>(l: List<A>): A | undefined;
28export declare function map<A, B>(f: (a: A) => B, l: List<A>): List<B>;
29export declare function pluck<A, K extends keyof A>(key: K, l: List<A>): List<A[K]>;
30export declare function range(start: number, end: number): List<number>;
31export declare function foldl<A, B>(f: (acc: B, value: A) => B, initial: B, l: List<A>): B;
32export declare const reduce: typeof foldl;
33export declare function filter<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
34export declare function reject<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
35export declare function partition<A>(predicate: (a: A) => boolean, l: List<A>): List<List<A>>;
36export declare function join(separator: string, l: List<string>): string;
37export declare function foldr<A, B>(f: (value: A, acc: B) => B, initial: B, l: List<A>): B;
38export declare const reduceRight: typeof foldr;
39export declare function flatten<A>(nested: List<List<A>>): List<A>;
40export declare function every<A>(predicate: (a: A) => boolean, l: List<A>): boolean;
41export declare const all: typeof every;
42export declare function some<A>(predicate: (a: A) => boolean, l: List<A>): boolean;
43export declare const any: typeof some;
44export declare function none<A>(predicate: (a: A) => boolean, l: List<A>): boolean;
45export declare function find<A>(predicate: (a: A) => boolean, l: List<A>): A | undefined;
46export declare function indexOf<A>(element: A, l: List<A>): number;
47export declare function findIndex<A>(predicate: (a: A) => boolean, l: List<A>): number;
48export declare function includes<A>(element: A, l: List<A>): boolean;
49export declare const contains: typeof includes;
50export declare function equals<A>(firstList: List<A>, secondList: List<A>): boolean;
51export declare function concat<A>(left: List<A>, right: List<A>): List<A>;
52export declare function update<A>(index: number, a: A, l: List<A>): List<A>;
53export declare function adjust<A>(f: (a: A) => A, index: number, l: List<A>): List<A>;
54export declare function slice<A>(from: number, to: number, l: List<A>): List<A>;
55export declare function take<A>(n: number, l: List<A>): List<A>;
56export declare function takeWhile<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
57export declare function dropWhile<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
58export declare function takeLast<A>(n: number, l: List<A>): List<A>;
59export declare function splitAt<A>(index: number, l: List<A>): [List<A>, List<A>];
60export declare function remove<A>(from: number, amount: number, l: List<A>): List<A>;
61export declare function drop<A>(n: number, l: List<A>): List<A>;
62export declare function dropLast<A>(n: number, l: List<A>): List<A>;
63export declare function pop<A>(l: List<A>): List<A>;
64export declare const init: typeof pop;
65export declare function tail<A>(l: List<A>): List<A>;
66export declare function toArray<A>(l: List<A>): A[];
67export declare function fromArray<A>(array: A[]): List<A>;
68export declare function fromIterable<A>(iterable: IterableIterator<A>): List<A>;
69export declare function insert<A>(index: number, element: A, l: List<A>): List<A>;
70export declare function insertAll<A>(index: number, elements: List<A>, l: List<A>): List<A>;