1 | export declare function setEquals(equals: (a: any, b: any) => boolean): void;
|
2 | export declare type Sizes = number[] | undefined;
|
3 | export declare class Node {
|
4 | sizes: Sizes;
|
5 | array: any[];
|
6 | constructor(sizes: Sizes, array: any[]);
|
7 | }
|
8 | export declare function nth<A>(index: number, l: List<A>): A | undefined;
|
9 | export 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 | }
|
19 | export declare function prepend<A>(value: A, l: List<A>): List<A>;
|
20 | export declare function append<A>(value: A, l: List<A>): List<A>;
|
21 | export declare function list<A>(...elements: A[]): List<A>;
|
22 | export declare function of<A>(a: A): List<A>;
|
23 | export declare function pair<A>(first: A, second: A): List<A>;
|
24 | export declare function empty(): List<any>;
|
25 | export declare function repeat<A>(value: A, times: number): List<A>;
|
26 | /**
|
27 | * Generates a new list by calling a function with the current index
|
28 | * `n` times.
|
29 | * @param func Function used to generate list values.
|
30 | * @param times Number of values to generate.
|
31 | */
|
32 | export declare function times<A>(func: (index: number) => A, times: number): List<A>;
|
33 | /**
|
34 | * Gets the length of a list.
|
35 | *
|
36 | * @example
|
37 | * length(list(0, 1, 2, 3)); //=> 4
|
38 | *
|
39 | * @param l The list to get the length of.
|
40 | */
|
41 | export declare function length(l: List<any>): number;
|
42 | export declare function first<A>(l: List<A>): A | undefined;
|
43 | export declare function last<A>(l: List<A>): A | undefined;
|
44 | export declare function map<A, B>(f: (a: A) => B, l: List<A>): List<B>;
|
45 | export declare function pluck<A, K extends keyof A>(key: K, l: List<A>): List<A[K]>;
|
46 | export declare function range(start: number, end: number): List<number>;
|
47 | /**
|
48 | * Folds a function over a list. Left-associative.
|
49 | *
|
50 | * @example
|
51 | * foldl((n, m) => n - m, 1, list(2, 3, 4, 5)); //=> -13
|
52 | */
|
53 | export declare function foldl<A, B>(f: (acc: B, value: A) => B, initial: B, l: List<A>): B;
|
54 | export declare const reduce: typeof foldl;
|
55 | export declare function forEach<A>(callback: (a: A) => void, l: List<A>): void;
|
56 | export declare function filter<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
|
57 | export declare function reject<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
|
58 | export declare function partition<A>(predicate: (a: A) => boolean, l: List<A>): List<List<A>>;
|
59 | export declare function join(separator: string, l: List<string>): string;
|
60 | export declare function foldr<A, B>(f: (value: A, acc: B) => B, initial: B, l: List<A>): B;
|
61 | export declare const reduceRight: typeof foldr;
|
62 | export declare function ap<A, B>(listF: List<(a: A) => B>, l: List<A>): List<B>;
|
63 | export declare function flatten<A>(nested: List<List<A>>): List<A>;
|
64 | export declare function chain<A, B>(f: (a: A) => List<B>, l: List<A>): List<B>;
|
65 | export declare function every<A>(predicate: (a: A) => boolean, l: List<A>): boolean;
|
66 | export declare const all: typeof every;
|
67 | export declare function some<A>(predicate: (a: A) => boolean, l: List<A>): boolean;
|
68 | export declare const any: typeof some;
|
69 | export declare function none<A>(predicate: (a: A) => boolean, l: List<A>): boolean;
|
70 | export declare function find<A>(predicate: (a: A) => boolean, l: List<A>): A | undefined;
|
71 | export declare function indexOf<A>(element: A, l: List<A>): number;
|
72 | export declare function findIndex<A>(predicate: (a: A) => boolean, l: List<A>): number;
|
73 | export declare function includes<A>(element: A, l: List<A>): boolean;
|
74 | export declare const contains: typeof includes;
|
75 | export declare function equals<A>(firstList: List<A>, secondList: List<A>): boolean;
|
76 | export declare function concat<A>(left: List<A>, right: List<A>): List<A>;
|
77 | export declare function update<A>(index: number, a: A, l: List<A>): List<A>;
|
78 | export declare function adjust<A>(index: number, f: (a: A) => A, l: List<A>): List<A>;
|
79 | export declare function slice<A>(from: number, to: number, l: List<A>): List<A>;
|
80 | export declare function take<A>(n: number, l: List<A>): List<A>;
|
81 | export declare function takeWhile<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
|
82 | export declare function dropWhile<A>(predicate: (a: A) => boolean, l: List<A>): List<A>;
|
83 | export declare function takeLast<A>(n: number, l: List<A>): List<A>;
|
84 | export declare function splitAt<A>(index: number, l: List<A>): [List<A>, List<A>];
|
85 | export declare function remove<A>(from: number, amount: number, l: List<A>): List<A>;
|
86 | export declare function drop<A>(n: number, l: List<A>): List<A>;
|
87 | export declare function dropLast<A>(n: number, l: List<A>): List<A>;
|
88 | export declare function pop<A>(l: List<A>): List<A>;
|
89 | export declare const init: typeof pop;
|
90 | export declare function tail<A>(l: List<A>): List<A>;
|
91 | export declare function toArray<A>(l: List<A>): A[];
|
92 | export declare function fromArray<A>(array: A[]): List<A>;
|
93 | export declare function fromIterable<A>(iterable: IterableIterator<A>): List<A>;
|
94 | export declare function insert<A>(index: number, element: A, l: List<A>): List<A>;
|
95 | export declare function insertAll<A>(index: number, elements: List<A>, l: List<A>): List<A>;
|
96 | /**
|
97 | * Reverses a list.
|
98 | * @category Updater
|
99 | * @param l The list to reverse.
|
100 | * @returns A reversed list.
|
101 | */
|
102 | export declare function reverse<A>(l: List<A>): List<A>;
|
103 | export declare function isList<A>(l: any): l is List<A>;
|
104 | export declare function zipWith<A, B, C>(f: (a: A, b: B) => C, as: List<A>, bs: List<B>): List<C>;
|
105 | export declare function zip<A, B>(as: List<A>, bs: List<B>): List<[A, B]>;
|
106 | export declare type Ordering = -1 | 0 | 1;
|
107 | export interface Ord {
|
108 | "fantasy-land/lte"(b: any): boolean;
|
109 | }
|
110 | export declare type Comparable = number | string | Ord;
|
111 | export declare function sort<A extends Comparable>(l: List<A>): List<A>;
|
112 | export declare function sortWith<A>(comparator: (a: A, b: A) => Ordering, l: List<A>): List<A>;
|
113 | export declare function sortBy<A, B extends Comparable>(f: (a: A) => B, l: List<A>): List<A>;
|