import { Voidable } from "../maybe"; import { Option } from "../option"; import { AnyPair, ArrayGuard } from "../types"; export declare function of(...iter: T[]): Iterable; export declare function collect(iter: Iterable): T[]; export declare function join(iter: Iterable, separator?: string): string; export declare function count(iter: Iterable): number; export declare function isEmpty(iter: Iterable): boolean; export declare function first(iter: Iterable): Voidable; export declare function firstO(iter: Iterable): Option; export declare function last(iter: Iterable): Voidable; export declare function lastO(iter: Iterable): Option; export declare function nth(iter: Iterable, n: number): Voidable; export declare function nthO(iter: Iterable, n: number): Option; export declare function stepBy(iter: Iterable, step: number): Iterable; export declare function chain(a: Iterable, b: Iterable, ...more: Iterable[]): Iterable; export declare function zip(a: Iterable, b: Iterable): Iterable<[A, B]>; export declare function unzip(iter: Iterable<[A, B]>): [A[], B[]]; export declare function map(iter: Iterable, f: (v: T) => R): Iterable; export declare function fill(iter: Iterable, v: R): Iterable; export declare function forEach(iter: Iterable, f: (v: T) => unknown): void; export declare function run(iter: Iterable): void; export declare function filter(iter: Iterable, f: (v: T) => v is S): Iterable; export declare function filter(iter: Iterable, f: (v: T) => unknown): Iterable; export declare function enumerate(iter: Iterable): Iterable<[T, number]>; export declare function indexed(iter: Iterable): Iterable<[number, T]>; export declare function skip(iter: Iterable, n: number): Iterable; export declare function take(iter: Iterable, n: number): Iterable; export declare function slice(iter: Iterable, from: number, to: number): Iterable; export declare function sub(iter: Iterable, from: number, count: number): Iterable; export declare function scan(iter: Iterable, init: R, f: (acc: R, val: T) => R): Iterable; export declare function flatMap(iter: Iterable, f: (v: T) => Iterable): Iterable; export declare function flatten(iter: Iterable>): Iterable; export declare function also(iter: Iterable, f: (v: T) => void): Iterable; export declare function fold(a: Iterable, init: R, f: (acc: R, val: T) => R): R; export declare function reduce(a: Iterable, f: (acc: T, val: T) => T): T; export declare function all(a: Iterable, f: (v: T) => v is S): a is Iterable; export declare function all(a: Iterable, f: (v: T) => unknown): boolean; export declare function any(a: Iterable, f: (v: T) => unknown): boolean; export declare function find(a: Iterable, f: (v: T) => unknown): Voidable; export declare function findO(a: Iterable, f: (v: T) => unknown): Option; export declare function position(a: Iterable, f: (v: T) => unknown): number; export declare function indexOf(a: Iterable, v: T): number; export declare function includes(a: Iterable, v: T): boolean; export declare function max(a: Iterable): Voidable; export declare function maxO(a: Iterable): Option; export declare function min(a: Iterable): Voidable; export declare function minO(a: Iterable): Option; export declare function sum(a: Iterable, defv: T): T; export declare function sum(a: Iterable): Voidable; export declare function avg(a: Iterable, defv: T): T; export declare function avg(a: Iterable): Voidable; export declare function push(a: Iterable, ...items: T[]): Iterable; export declare function unshift(a: Iterable, ...items: T[]): Iterable; export declare function as(a: Iterable): Iterable; export declare function toArray(a: Iterable): T[]; export declare function toSet(a: Iterable): Set; export declare function toMap(a: Iterable<[K, V]>): Map; export declare function toMap(a: Iterable): Map; export declare function toMap(a: Iterable<[K, V] | readonly [K, V]>): Map; /** Cartesian product */ export declare function product[]>(...iters: O): Iterable ? T : never; }>>; export declare function product(...iters: Iterable[]): Iterable; export declare function groupBy(a: Iterable, keyf: (v: T) => K): Iterable<[K, T[]]>; export declare function groupBy(a: Iterable, keyf: (v: T) => K, valf: (v: T) => V): Iterable<[K, V[]]>; /** sql inner join */ export declare function relate(outer: Iterable, inner: Iterable, outerKey: (a: O) => K, innerKey: (b: I) => K): Iterable<[O, I]>; /** sql inner join */ export declare function relateMap(outer: Iterable, inner: Iterable, outerKey: (a: O) => K, innerKey: (b: I) => K, selector: (a: O, b: I) => R): Iterable; export declare function mapKey(iter: Iterable<[K, V]>, f: (key: K) => R): Iterable<[R, V]>; export declare function mapKey(iter: Iterable, f: (key: K) => R): Iterable<[R, V]>; export declare function mapKey(iter: Iterable>, f: (key: K) => R): Iterable<[R, V]>; export declare function mapValue(iter: Iterable<[K, V]>, f: (val: V) => R): Iterable<[K, R]>; export declare function mapValue(iter: Iterable, f: (val: V) => R): Iterable<[K, R]>; export declare function mapValue(iter: Iterable>, f: (val: V) => R): Iterable<[K, R]>;