UNPKG

extra-lists

Version:

A collection of functions for operating upon Lists.<br>

587 lines (586 loc) • 23.6 kB
/** Entries is an array of key-value pairs, with unique keys. */ export type Entries<K, V> = [K, V][]; /** Lists is a pair of key array and value array, with unique keys. */ export type Lists<K, V> = [K[], V[]]; /** * Handle reading of a single value. * @returns value */ export type ReadFunction<T> = () => T; /** * Handle combining of two values. * @param a a value * @param b another value * @returns combined value */ export type CombineFunction<T> = (a: T, b: T) => T; /** * Handle comparison of two values. * @param a a value * @param b another value * @returns a<b: -ve, a=b: 0, a>b: +ve */ export type CompareFunction<T> = (a: T, b: T) => number; /** * Handle processing of values in lists. * @param v value in lists * @param k key of value in lists * @param x lists containing the value */ export type ProcessFunction<K, V> = (v: V, k: K, x: Lists<K, V>) => void; /** * Handle selection of values in lists. * @param v value in lists * @param k key of value in lists * @param x lists containing the value * @returns selected? */ export type TestFunction<K, V> = (v: V, k: K, x: Lists<K, V>) => boolean; /** * Handle transformation of a value to another. * @param v value in lists * @param k key of value in lists * @param x lists containing the value * @returns transformed value */ export type MapFunction<K, V, W> = (v: V, k: K, x: Lists<K, V> | null) => W; /** * Handle reduction of multiple values into a single value. * @param acc accumulator (temporary result) * @param v value in lists * @param k key of value in lists * @param x lists containing the value * @returns reduced value */ export type ReduceFunction<K, V, W> = (acc: W, v: V, k: K, x: Lists<K, V>) => W; /** * Handle ending of combined lists. * @param dones iᵗʰ lists done? * @returns combined lists done? */ export type EndFunction = (dones: boolean[]) => boolean; /** * Check if value is lists. * @param v value * @returns v is lists? */ export declare function is<K, V>(v: unknown): v is Lists<K, V>; /** * Get all keys. * @param x lists * @returns [k₀, k₁, ...] | kᵢ ∈ x[0] */ export declare function keys<K, V>(x: Lists<K, V>): K[]; /** * Get all values. * @param x lists * @returns [v₀, v₁, ...] | vᵢ ∈ x[1] */ export declare function values<K, V>(x: Lists<K, V>): V[]; /** * Obtain all key-value pairs. * @param x lists * @returns [[k₀, v₀], [k₁, v₁], ...] | kᵢ ∈ x[0]; vᵢ ∈ x[1] */ export declare function entries<K, V>(x: Lists<K, V>): Entries<K, V>; /** * Convert map to lists. * @param x map * @returns x as lists */ export declare function fromMap<K, V>(x: Map<K, V>): Lists<K, V>; /** * Convert entries to lists. * @param x entries * @returns x as lists */ export declare function fromEntries<K, V>(x: Entries<K, V>): Lists<K, V>; /** * Shallow clone lists. * @param x lists * @returns shallow clone of x */ export declare function shallowClone<K, V>(x: Lists<K, V>): Lists<K, V>; export { shallowClone as shallowCopy }; export { shallowClone as clone }; export { shallowClone as copy }; /** * Deep clone lists. * @param x lists * @returns deep clone of x */ export declare function deepClone<K, V>(x: Lists<K, V>): Lists<K, V>; export { deepClone as structuredClone }; export { deepClone as deepCopy }; /** * Find the size of lists. * @param x lists * @returns |x| */ export declare function size<K, V>(x: Lists<K, V>): number; export { size as length }; /** * Check if lists is empty. * @param x lists * @returns |x| = 0? */ export declare function isEmpty<K, V>(x: Lists<K, V>): boolean; /** * Compare two lists. * @param x lists * @param y another lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns x=y: 0, otherwise: -ve/+ve */ export declare function compare<K, V, W = V>(x: Lists<K, V>, y: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): number; /** * Check if two lists are equal. * @param x lists * @param y another lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns x=y? */ export declare function isEqual<K, V, W = V>(x: Lists<K, V>, y: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): boolean; /** * Get key at index. * @param x lists * @param i index * @returns k₀ | kᵢ = x[0][i] */ export declare function keyAt<K, V>(x: Lists<K, V>, i: number): K; /** * Get value at index. * @param x lists * @param i index * @returns v₀ | vᵢ = x[1][i] */ export declare function valueAt<K, V>(x: Lists<K, V>, i: number): V; /** * Get entry at index. * @param x lists * @param i index * @returns [k₀, v₀] | kᵢ = x[0][i]; vᵢ = x[1][i] */ export declare function entryAt<K, V>(x: Lists<K, V>, i: number): [K, V]; /** * Obtain value at key. * @param x lists * @param k key * @returns x[k] */ export declare function get<K, V>(x: Lists<K, V>, k: K): V | undefined; /** * Obtain values at keys. * @param x lists * @param ks keys * @returns [x[k₀], x[k₁], ...] | [k₀, k₁, ...] = ks */ export declare function getAll<K, V>(x: Lists<K, V>, ks: K[]): V[]; /** * Obtain value at path in nested lists. * @param x nested lists * @param p path * @returns x[k₀][k₁][...] | [k₀, k₁, ...] = p */ export declare function getPath<K>(x: Lists<K, unknown>, p: K[]): unknown; /** * Check if nested lists has a path. * @param x nested lists * @param p search path * @returns x[k₀][k₁][...] exists? | [k₀, k₁, ...] = p */ export declare function hasPath<T>(x: Lists<T, unknown>, p: T[]): boolean; /** * Set value at key. * @param x lists (updated!) * @param k key * @param v value * @returns x | x[k] = v */ export declare function set$<K, V>(x: Lists<K, V>, k: K, v: V): Lists<K, V>; /** * Set value at key. * @param x lists * @param k key * @param v value * @returns x' | x' = x; x'[k] = v */ export declare function set<K, V>(x: Lists<K, V>, k: K, v: V): Lists<K, V>; /** * Exchange two values. * @param x lists (updated!) * @param k a key * @param l another key * @returns x | x[k] ⇔ x[l] */ export declare function swap$<K, V>(x: Lists<K, V>, k: K, l: K): Lists<K, V>; /** * Exchange two values. * @param x lists * @param k a key * @param l another key * @returns x' | x' = x; x'[k] = x[l]; x'[l] = x[k] */ export declare function swap<K, V>(x: Lists<K, V>, k: K, l: K): Lists<K, V>; /** * Remove value at key. * @param x lists (updated!) * @param k key * @returns x | x = x \\ \{[k, *]\} */ export declare function remove$<K, V>(x: Lists<K, V>, k: K): Lists<K, V>; /** * Remove value at key. * @param x lists * @param k key * @returns x \\ \{[k, *]\} */ export declare function remove<K, V>(x: Lists<K, V>, k: K): Lists<K, V>; /** * Get first entry from lists. * @param x lists * @param ed default entry * @returns [k₀, v₀] if x ≠ Φ else ed | [k₀, v₀] ∈ x */ export declare function head<K, V>(x: Lists<K, V>, ed?: [K, V]): [K, V]; /** * Obtain lists without its first entry. * @param x lists * @returns x \\ \{[k₀, v₀]\} if x ≠ Φ else x | [k₀, v₀] ∈ x */ export declare function tail<K, V>(x: Lists<K, V>): Lists<K, V>; /** * Obtain all but the last entry from lists. * @param x lists * @returns x \\ \{[kᵢ, vᵢ]\} if x ≠ Φ else x | [kᵢ, vᵢ] ∈ x; i = |x| - 1 */ export declare function init<K, V>(x: Lists<K, V>): Lists<K, V>; /** * Get last entry from lists. * @param x lists * @param ed default entry * @returns [kᵢ, vᵢ] if x ≠ Φ else ed | [kᵢ, vᵢ] ∈ x; i = |x| - 1 */ export declare function last<K, V>(x: Lists<K, V>, ed?: [K, V]): [K, V]; /** * Obtain a portion of lists (shallow). * @param x lists (updated!) * @param i start index [0] * @param I end index (exclusive) [|x|] * @returns x | x = \{[kᵢ, vᵢ], [kᵢ₊₁, vᵢ₊₁], ...\} | [kⱼ, vⱼ] ∈ x and i ≤ j < I */ export declare function slice$<K, V>(x: Lists<K, V>, i?: number, I?: number): Lists<K, V>; /** * Obtain a portion of lists (shallow). * @param x lists * @param i start index [0] * @param I end index (exclusive) [|x|] * @returns \{[kᵢ, vᵢ], [kᵢ₊₁, vᵢ₊₁], ...\} | [kⱼ, vⱼ] ∈ x and i ≤ j < I */ export declare function slice<K, V>(x: Lists<K, V>, i?: number, I?: number): Lists<K, V>; /** * Change contents of lists by removing existing entries and/or adding new ones. * @param x lists (updated!) * @param i start index [0] * @param n number of entries to remove [|x|-i] * @param es entries to add [Φ] * @returns x | x = \{[k₀, v₀], ..., [kᵢ₋₁, vᵢ₋₁], [kᵢ₊ₙ, vᵢ₊ₙ], ...\} | [kⱼ, vⱼ] ∈ x and j ∈ [0, i) ∪ [i+n, |x|) */ export declare function splice$<K, V>(x: Lists<K, V>, i?: number, n?: number, ...es: [K, V][]): Lists<K, V>; /** * Change contents of lists by removing existing entries and/or adding new ones. * @param x lists * @param i start index [0] * @param n number of entries to remove [|x|-i] * @param es entries to add [Φ] * @returns \{[k₀, v₀], ..., [kᵢ₋₁, vᵢ₋₁], [kᵢ₊ₙ, vᵢ₊ₙ], ...\} | [kⱼ, vⱼ] ∈ x and j ∈ [0, i) ∪ [i+n, |x|) */ export declare function splice<K, V>(x: Lists<K, V>, i?: number, n?: number, ...es: [K, V][]): Lists<K, V>; /** * Keep first n entries only. * @param x lists (updated!) * @param n number of entries [1] * @returns x | x = \{[k₀, v₀], [k₁, v₁], ...\} | [kᵢ, vᵢ] ∈ x and |\{[k₀, v₀], [k₁, v₁], ...\}| ≤ n */ export declare function take$<K, V>(x: Lists<K, V>, n?: number): Lists<K, V>; /** * Keep first n entries only. * @param x lists * @param n number of entries [1] * @returns \{[k₀, v₀], [k₁, v₁], ...\} | [kᵢ, vᵢ] ∈ x and |\{[k₀, v₀], [k₁, v₁], ...\}| ≤ n */ export declare function take<K, V>(x: Lists<K, V>, n?: number): Lists<K, V>; /** * Remove first n entries. * @param x lists (updated!) * @param n number of entries [1] * @returns x | x = \{[kₙ, vₙ], [kₙ₊₁, vₙ₊₁], ...\} | [kᵢ, vᵢ] ∈ x and |\{[kₙ, vₙ], [kₙ₊₁, vₙ₊₁], ...\}| ≤ max(|x| - n, 0) */ export declare function drop$<K, V>(x: Lists<K, V>, n?: number): Lists<K, V>; /** * Remove first n entries. * @param x a map * @param n number of entries [1] * @returns \{[kₙ, vₙ], [kₙ₊₁, vₙ₊₁], ...\} | [kᵢ, vᵢ] ∈ x and |\{[kₙ, vₙ], [kₙ₊₁, vₙ₊₁], ...\}| ≤ max(|x| - n, 0) */ export declare function drop<K, V>(x: Lists<K, V>, n?: number): Lists<K, V>; /** * Count values which satisfy a test. * @param x lists * @param ft test function (v, k, x) * @returns Σtᵢ | tᵢ = 1 if ft(vᵢ) else 0; [kᵢ, vᵢ] ∈ x */ export declare function count<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): number; /** * Count occurrences of values. * @param x lists * @param fm map function (v, k, x) * @returns Map \{value ⇒ count\} */ export declare function countAs<K, V, W = V>(x: Lists<K, V>, fm?: MapFunction<K, V, V | W> | null): Map<V | W, number>; /** * Find smallest value. * @param x lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns v | v ≤ vᵢ; [kᵢ, vᵢ] ∈ x */ export declare function min<K, V, W = V>(x: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): V; /** * Find smallest entry. * @param x lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns [min_key, min_value] */ export declare function minEntry<K, V, W = V>(x: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): [K, V]; /** * Find largest value. * @param x lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns v | v ≥ vᵢ; [kᵢ, vᵢ] ∈ x */ export declare function max<K, V, W = V>(x: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): V; /** * Find largest entry. * @param x lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns [max_key, max_value] */ export declare function maxEntry<K, V, W = V>(x: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): [K, V]; /** * Find smallest and largest values. * @param x lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns [min_value, max_value] */ export declare function range<K, V, W = V>(x: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): [V, V]; /** * Find smallest and largest entries. * @param x lists * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns [min_entry, max_entry] */ export declare function rangeEntries<K, V, W = V>(x: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): [[K, V], [K, V]]; /** * List all possible subsets. * @param x lists * @param n number of entries in each subset [-1 ⇒ any] * @returns entries selected by bit from 0..2^|x| if n<0; only of length n otherwise */ export declare function subsets<K, V>(x: Lists<K, V>, n?: number): Iterable<Lists<K, V>>; /** * Pick an arbitrary key. * @param x lists * @param fr random number generator ([0, 1)) * @returns kᵢ | kᵢ ∈ x[0] */ export declare function randomKey<K, V>(x: Lists<K, V>, fr?: ReadFunction<number>): K; export { randomKey as key }; /** * Pick an arbitrary value. * @param x lists * @param fr random number generator ([0, 1)) * @returns vᵢ | vᵢ ∈ x[1] */ export declare function randomValue<K, V>(x: Lists<K, V>, fr?: ReadFunction<number>): V; export { randomValue as value }; /** * Pick an arbitrary entry. * @param x lists * @param fr random number generator ([0, 1)) * @returns [kᵢ, vᵢ] | kᵢ ∈ x[0]; vᵢ ∈ x[1] */ export declare function randomEntry<K, V>(x: Lists<K, V>, fr?: ReadFunction<number>): [K, V]; export { randomEntry as entry }; /** * Pick an arbitrary subset. * @param x lists * @param n number of entries [-1 ⇒ any] * @param fr random number generator ([0, 1)) * @returns [[kᵢ, kⱼ, ...], [vᵢ, vⱼ, ...]] | kᵢ, kⱼ, ... ∈ x[0]; vᵢ, vⱼ, ... ∈ x[1]; |[kᵢ, kⱼ, , ...]| = |x| if n<0 else n */ export declare function randomSubset<K, V>(x: Lists<K, V>, n?: number, fr?: ReadFunction<number>): Lists<K, V>; export { randomSubset as subset }; /** * Check if lists has a key. * @param x lists * @param k search key * @returns k ∈ keys(x)? */ export declare function hasKey<K, V>(x: Lists<K, V>, k: K): boolean; export { hasKey as has }; /** * Check if lists has a value. * @param x lists * @param v search value * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns v ∈ values(x)? */ export declare function hasValue<K, V, W = V>(x: Lists<K, V>, v: V, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): boolean; /** * Check if lists has an entry. * @param x lists * @param e search entry * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns k ∈ x[0]; v ∈ x[1]; k ⇒ v? | [k, v] = e */ export declare function hasEntry<K, V, W = V>(x: Lists<K, V>, e: [K, V], fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): boolean; /** * Check if lists has a subset. * @param x lists * @param y search subset * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns y ⊆ x? */ export declare function hasSubset<K, V, W = V>(x: Lists<K, V>, y: Lists<K, V>, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): boolean; /** * Find first value passing a test (default order). * @param x lists * @param ft test function (v, k, x) * @returns first v | ft(v) = true; [k, v] ∈ x */ export declare function find<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): V | undefined; /** * Find values passing a test. * @param x lists * @param ft test function (v, k, x) * @returns v₀, v₁, ... | ft(vᵢ) = true; [kᵢ, vᵢ] ∈ x */ export declare function findAll<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): Iterable<V>; /** * Finds key of an entry passing a test. * @param x lists * @param ft test function (v, k, x) * @returns key of entry */ export declare function search<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): K | undefined; /** * Find keys of entries passing a test. * @param x lists * @param ft test function (v, k, x) * @returns keys of entries */ export declare function searchAll<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): Iterable<K>; /** * Find a key with given value. * @param x lists * @param v search value * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns key of value */ export declare function searchValue<K, V, W = V>(x: Lists<K, V>, v: V, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): K | undefined; /** * Find keys with given value. * @param x lists * @param v search value * @param fc compare function (a, b) * @param fm map function (v, k, x) * @returns keys of value */ export declare function searchValueAll<K, V, W = V>(x: Lists<K, V>, v: V, fc?: CompareFunction<V | W> | null, fm?: MapFunction<K, V, V | W> | null): Iterable<K>; /** * Call a function for each value. * @param x lists * @param fp process function (v, k, x) */ export declare function forEach<K, V>(x: Lists<K, V>, fc: ProcessFunction<K, V>): void; /** * Check if any value satisfies a test. * @param x lists * @param ft test function (v, k, x) * @returns true if ft(vᵢ) = true for some [kᵢ, vᵢ] ∈ x */ export declare function some<K, V>(x: Lists<K, V>, ft?: TestFunction<K, V> | null): boolean; /** * Check if all values satisfy a test. * @param x entries * @param ft test function (v, k, x) * @returns true if ft(vᵢ) = true for every [kᵢ, vᵢ] ∈ x */ export declare function every<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): boolean; /** * Transform values of entries. * @param x lists * @param fm map function (v, k, x) * @returns [k₀, fm(v₀)], [k₁, fm(v₁)], ... | [kᵢ, vᵢ] ∈ x */ export declare function map<K, V, W>(x: Lists<K, V>, fm: MapFunction<K, V, W>): Lists<K, W>; /** * Reduce values of entries to a single value. * @param x lists * @param fr reduce function (acc, v, k, x) * @param acc initial value * @returns fr(fr(acc, v₀), v₁)... | fr(acc, v₀) = v₀ if acc not given */ export declare function reduce<K, V, W = V>(x: Lists<K, V>, fr: ReduceFunction<K, V, V | W>, acc?: V | W): V | W; /** * Keep entries which pass a test. * @param x lists * @param ft test function (v, k, x) * @returns [k₀, v₀], [k₁, v₁], ... | ft(vᵢ) = true; [kᵢ, vᵢ] ∈ x */ export declare function filter<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): Lists<K, V>; /** * Keep entries with given keys. * @param x lists * @param ks keys * @returns [k₀, v₀], [k₁, v₁], ... | kᵢ ∈ ks; [kᵢ, vᵢ] ∈ x */ export declare function filterAt<K, V>(x: Lists<K, V>, ks: K[]): Lists<K, V>; /** * Discard entries which pass a test. * @param x lists * @param ft test function (v, k, x) * @returns [k₀, v₀], [k₁, v₁], ... | ft(vᵢ) = false; [kᵢ, vᵢ] ∈ x */ export declare function reject<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): Lists<K, V>; /** * Discard entries with given keys. * @param x lists * @param ks keys * @returns [k₀, v₀], [k₁, v₁], ... | kᵢ ∉ ks; [kᵢ, vᵢ] ∈ x */ export declare function rejectAt<K, V>(x: Lists<K, V>, ks: K[]): Lists<K, V>; /** * Flatten nested lists to given depth. * @param x nested lists * @param n maximum depth [-1 ⇒ all] * @param fm map function (v, k, x) * @param ft test function for flatten (v, k, x) [is] * @returns flat lists */ export declare function flat<K>(x: Lists<K, unknown>, n?: number, fm?: MapFunction<K, unknown, unknown> | null, ft?: TestFunction<K, unknown> | null): Lists<K, unknown>; /** * Flatten nested lists, based on map function. * @param x nested lists * @param fm map function (v, k, x) * @param ft test function for flatten (v, k, x) [is] * @returns flat lists */ export declare function flatMap<K>(x: Lists<K, unknown>, fm?: MapFunction<K, unknown, unknown> | null, ft?: TestFunction<K, unknown> | null): Lists<K, unknown>; /** * Combine matching entries from all lists. * @param xs all lists * @param fm map function (vs, k) * @param ft end function (dones) [some] * @param vd default value * @returns fm([x₀[k₀], x₁[k₀], ...]), fm([x₀[k₁], x₁[k₁], ...]), ... */ export declare function zip<K, V, W = V>(xs: Lists<K, V>[], fm?: MapFunction<K, V[], V[] | W> | null, ft?: EndFunction | null, vd?: V): Lists<K, V[] | W>; /** * Segregate values by test result. * @param x lists * @param ft test function (v, k, x) * @returns [satisfies, doesnt] */ export declare function partition<K, V>(x: Lists<K, V>, ft: TestFunction<K, V>): [Lists<K, V>, Lists<K, V>]; /** * Segregate entries by similarity. * @param x entries * @param fm map function (v, k, x) * @returns Map \{key ⇒ entries\} */ export declare function partitionAs<K, V, W = V>(x: Lists<K, V>, fm?: MapFunction<K, V, V | W> | null): Map<V | W, Lists<K, V>>; /** * Break lists into chunks of given size. * @param x lists * @param n chunk size [1] * @param s chunk step [n] * @returns [x[0..n], x[s..s+n], x[2s..2s+n], ...] */ export declare function chunk<K, V>(x: Lists<K, V>, n?: number, s?: number): Lists<K, V>[]; /** * Append entries from all lists, preferring last. * @param xs all lists * @returns x₀ ∪ x₁ ∪ ... | [x₀, x₁, ...] = xs */ export declare function concat<K, V>(...xs: Lists<K, V>[]): Lists<K, V>; /** * Join lists together into a string. * @param x lists * @param sep separator [,] * @param asc associator [=] * @returns "$\{k₀\}=$\{v₀\},$\{k₁\}=$\{v₁\}..." | [kᵢ, vᵢ] ∈ x */ export declare function join<K, V>(x: Lists<K, V>, sep?: string, asc?: string): string; /** * Check if lists have no common keys. * @param x lists * @param y another lists * @returns x ∩ y = Φ? */ export declare function isDisjoint<K, V>(x: Lists<K, V>, y: Lists<K, V>): boolean; /** * Obtain keys present in any lists. * @param xs all lists * @returns \{k₀, k₁, ...\} | [kᵢ, vᵢ] ∈ x₀ ∪ x₁, ...; [x₀, x₁, ...] = xs */ export declare function unionKeys<K, V>(...xs: Lists<K, V>[]): Set<K>; /** * Obtain entries present in any lists. * @param x lists * @param y another lists * @param fc combine function (a, b) * @returns x ∪ y = \{[kᵢ, vᵢ] | [kᵢ, vᵢ] ∈ x or [kᵢ, vᵢ] ∈ y\} */ export declare function union<K, V>(x: Lists<K, V>, y: Lists<K, V>, fc?: CombineFunction<V> | null): Lists<K, V>; /** * Obtain entries present in both lists. * @param x lists * @param y another lists * @param fc combine function (a, b) * @returns x ∩ y = \{[kᵢ, vᵢ] | [kᵢ, vᵢ] ∈ x and [kᵢ, vᵢ] ∈ y\} */ export declare function intersection<K, V>(x: Lists<K, V>, y: Lists<K, V>, fc?: CombineFunction<V> | null): Lists<K, V>; /** * Obtain entries not present in another lists. * @param x lists * @param y another lists * @returns x = x - y = \{[kᵢ, vᵢ] | [kᵢ, vᵢ] ∈ x, [kᵢ, *] ∉ y\} */ export declare function difference<K, V>(x: Lists<K, V>, y: Lists<K, V>): Lists<K, V>; /** * Obtain entries not present in both lists. * @param x lists * @param y another lists * @returns x = x-y ∪ y-x */ export declare function symmetricDifference<K, V>(x: Lists<K, V>, y: Lists<K, V>): Lists<K, V>;