import "../../../Operator/index.js"; import type { Refinement } from "../../../Function/index.js"; import * as O from "../../../Option/index.js"; import * as St from "../../../Structural/index.js"; import * as Tp from "../Tuple/index.js"; import type { Node, UpdateFn } from "./Nodes/index.js"; export declare class HashMap implements Iterable { editable: boolean; edit: number; root: Node; size: number; readonly _K: () => K; readonly _V: () => V; constructor(editable: boolean, edit: number, root: Node, size: number); [Symbol.iterator](): Iterator; readonly tupleIterator: Iterable>; get [St.hashSym](): number; [St.equalsSym](that: unknown): boolean; } export declare class HashMapIterator implements IterableIterator { readonly map: HashMap; readonly f: TraversalFn; v: O.Option>; constructor(map: HashMap, f: TraversalFn); next(): IteratorResult; [Symbol.iterator](): IterableIterator; } /** * Creates a new map */ export declare function make(): HashMap; /** * Creates a new map from an Iterable */ export declare function from(xs: Iterable): HashMap; /** * Set the root of the map */ export declare function setTree_(map: HashMap, newRoot: Node, newSize: number): HashMap; /** * Lookup the value for `key` in `map` using custom hash. */ export declare function tryGetHash_(map: HashMap, key: K, hash: number): O.Option; /** * Lookup the value for `key` in `map` using custom hash. */ export declare function getHash_(map: HashMap, key: K, hash: number): O.Option; /** * Lookup the value for `key` in `map` using internal hash function. */ export declare function unsafeGet_(map: HashMap, key: K): V; /** * Lookup the value for `key` in `map` using internal hash function. * * @ets_data_first unsafeGet_ */ export declare function unsafeGet(key: K): (map: HashMap) => V; /** * Lookup the value for `key` in `map` using internal hash function. */ export declare function get_(map: HashMap, key: K): O.Option; /** * Lookup the value for `key` in `map` using internal hash function. * * @ets_data_first get_ */ export declare function get(key: K): (map: HashMap) => O.Option; /** * Does an entry exist for `key` in `map`? Uses custom `hash`. */ export declare function hasHash_(map: HashMap, key: K, hash: number): boolean; /** * Does an entry exist for `key` in `map`? Uses internal hash function. */ export declare function has_(map: HashMap, key: K): boolean; /** * Does an entry exist for `key` in `map`? Uses internal hash function. * * @ets_data_first has_ */ export declare function has(key: K): (map: HashMap) => boolean; /** * Does `map` contain any elements? */ export declare function isEmpty(map: HashMap): boolean; /** * Alter the value stored for `key` in `map` using function `f` using custom hash. * * `f` is invoked with the current value for `k` if it exists, * or no arguments if no such value exists. * * `modify` will always either update or insert a value into the map. * Returns a map with the modified value. Does not alter `map`. */ export declare function modifyHash_(map: HashMap, key: K, hash: number, f: UpdateFn): HashMap; /** * Alter the value stored for `key` in `map` using function `f` using internal hash function. * * `f` is invoked with the current value for `k` if it exists, * or no arguments if no such value exists. * * `modify` will always either update or insert a value into the map. * Returns a map with the modified value. Does not alter `map`. */ export declare function modify_(map: HashMap, key: K, f: UpdateFn): HashMap; /** * Alter the value stored for `key` in `map` using function `f` using internal hash function. * * `f` is invoked with the current value for `k` if it exists, * or no arguments if no such value exists. * * `modify` will always either update or insert a value into the map. * Returns a map with the modified value. Does not alter `map`. * * @ets_data_first modify_ */ export declare function modify(key: K, f: UpdateFn): (map: HashMap) => HashMap; /** * Store `value` for `key` in `map` using internal hash function. */ export declare function set_(map: HashMap, key: K, value: V): HashMap; /** * Store `value` for `key` in `map` using internal hash function. * * @ets_data_first set_ */ export declare function set(key: K, value: V): (map: HashMap) => HashMap; /** * Remove the entry for `key` in `map` using internal hash. */ export declare function remove_(map: HashMap, key: K): HashMap; /** * Remove the entry for `key` in `map` using internal hash. * * @ets_data_first remove_ */ export declare function remove(key: K): (map: HashMap) => HashMap; /** * Mark `map` as mutable. */ export declare function beginMutation(map: HashMap): HashMap; /** * Mark `map` as immutable. */ export declare function endMutation(map: HashMap): HashMap; /** * Mutate `map` within the context of `f`. * * @ets_data_first mutate_ */ export declare function mutate(f: (map: HashMap) => void): (map: HashMap) => HashMap; /** * Mutate `map` within the context of `f`. */ export declare function mutate_(map: HashMap, f: (map: HashMap) => void): HashMap; export declare type Cont = [ len: number, children: Node[], i: number, f: TraversalFn, cont: Cont ] | undefined; export declare function applyCont(cont: Cont): O.None | O.Some>; export declare function visitLazyChildren(len: number, children: Node[], i: number, f: TraversalFn, cont: Cont): O.Option>; export interface VisitResult { value: A; cont: Cont; } export declare type TraversalFn = (node: readonly [K, V]) => A; /** * Visit each leaf lazily */ export declare function visitLazy(node: Node, f: TraversalFn, cont?: Cont): O.Option>; /** * Get an IterableIterator of the map keys */ export declare function keys(map: HashMap): IterableIterator; /** * Get an IterableIterator of the map values */ export declare function values(map: HashMap): IterableIterator; /** * Update a value if exists */ export declare function update_(map: HashMap, key: K, f: (v: V) => V): HashMap; /** * Update a value if exists * * @ets_data_first update_ */ export declare function update(key: K, f: (v: V) => V): (map: HashMap) => HashMap; /** * Reduce a state over the map entries */ export declare function reduceWithIndex_(map: HashMap, z: Z, f: (z: Z, k: K, v: V) => Z): Z; /** * Reduce a state over the map entries * * @ets_data_first reduceWithIndex_ */ export declare function reduceWithIndex(z: Z, f: (z: Z, k: K, v: V) => Z): (map: HashMap) => Z; /** * Reduce a state over the map entries */ export declare function reduce_(map: HashMap, z: Z, f: (z: Z, v: V) => Z): Z; /** * Reduce a state over the map entries * * @ets_data_first reduce_ */ export declare function reduce(z: Z, f: (z: Z, v: V) => Z): (map: HashMap) => Z; /** * Apply f to each element */ export declare function forEachWithIndex_(map: HashMap, f: (k: K, v: V) => void): void; /** * Apply f to each element * * @ets_data_first forEachWithIndex_ */ export declare function forEachWithIndex(f: (k: K, v: V) => void): (map: HashMap) => void; /** * Apply f to each element */ export declare function forEach_(map: HashMap, f: (v: V) => void): void; /** * Apply f to each element * * @ets_data_first forEach_ */ export declare function forEach(f: (v: V) => void): (map: HashMap) => void; /** * Maps over the map entries */ export declare function mapWithIndex_(map: HashMap, f: (k: K, v: V) => A): HashMap; /** * Maps over the map entries * * @ets_data_first mapWithIndex_ */ export declare function mapWithIndex(f: (k: K, v: V) => A): (map: HashMap) => HashMap; /** * Maps over the map entries */ export declare function map_(map: HashMap, f: (v: V) => A): HashMap; /** * Maps over the map entries * * @ets_data_first map_ */ export declare function map(f: (v: V) => A): (map: HashMap) => HashMap; /** * Chain over the map entries, the hash and equal of the 2 maps has to be the same */ export declare function chain_(map: HashMap, f: (v: V) => HashMap): HashMap; /** * Chain over the map entries, the hash and equal of the 2 maps has to be the same * * @ets_data_first chain_ */ export declare function chain(f: (v: V) => HashMap): (map: HashMap) => HashMap; /** * Chain over the map entries, the hash and equal of the 2 maps has to be the same */ export declare function chainWithIndex_(map: HashMap, f: (k: K, v: V) => HashMap): HashMap; /** * Chain over the map entries, the hash and equal of the 2 maps has to be the same * * @ets_data_first chainWithIndex_ */ export declare function chainWithIndex(f: (k: K, v: V) => HashMap): (map: HashMap) => HashMap; /** * Removes None values */ export declare function compact(fa: HashMap>): HashMap; /** * Filter out None and map */ export declare function filterMapWithIndex_(fa: HashMap, f: (k: K, a: A) => O.Option): HashMap; /** * Filter out None and map * * @ets_data_first filterMapWithIndex_ */ export declare function filterMapWithIndex(f: (k: K, a: A) => O.Option): (fa: HashMap) => HashMap; /** * Filter out None and map */ export declare function filterMap_(fa: HashMap, f: (a: A) => O.Option): HashMap; /** * Filter out None and map * * @ets_data_first filterMap_ */ export declare function filterMap(f: (a: A) => O.Option): (fa: HashMap) => HashMap; /** * Filter out by predicate */ export declare function filterWithIndex_(fa: HashMap, p: (k: K, a: A) => boolean): HashMap; /** * Filter out by predicate * * @ets_data_first filterWithIndex_ */ export declare function filterWithIndex(p: (k: K, a: A) => boolean): (fa: HashMap) => HashMap; /** * Filter out by predicate */ export declare function filter_(fa: HashMap, p: Refinement): HashMap; export declare function filter_(fa: HashMap, p: (a: A) => boolean): HashMap; /** * Filter out by predicate * * @ets_data_first filter_ */ export declare function filter(p: Refinement): (fa: HashMap) => HashMap; /** * Calculate the number of key/value pairs in a map */ export declare function size(map: HashMap): number; /** * Remove many keys */ export declare function removeMany_(self: HashMap, ks: Iterable): HashMap; /** * Remove many keys * * @ets_data_first removeMany_ */ export declare function removeMany(ks: Iterable): (self: HashMap) => HashMap; //# sourceMappingURL=core.d.ts.map