Logo Mibo

AMap Module

Operations on adaptive maps.

Functions and values

Function or value Description

averageBy mapping mapValue

Full Usage: averageBy mapping mapValue

Parameters:
    mapping : 'k -> 'v -> ^u
    mapValue : amap<'k, 'v>

Returns: aval<^u>
Modifiers: inline
Type parameters: 'k, 'v, ^u (requires equality and (static member DivideByInt : ^u * Microsoft.FSharp.Core.int -> ^u) and (static member get_Zero : -> ^u) and (static member op_Addition : ^u * ^u -> ^u) and (static member op_Subtraction : ^u * ^u -> ^u))

Adaptively averages the mapped entries (needs a numeric type with DivideByInt, e.g. float). The average is sum/count.

mapping : 'k -> 'v -> ^u
mapValue : amap<'k, 'v>
Returns: aval<^u>

averageByA mapping mapValue

Full Usage: averageByA mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<^U>
    mapValue : amap<'K, 'V>

Returns: aval<^U>
Modifiers: inline
Type parameters: 'K, 'V, ^U (requires equality and (static member DivideByInt : ^U * Microsoft.FSharp.Core.int -> ^U) and (static member get_Zero : -> ^U) and (static member op_Addition : ^U * ^U -> ^U) and (static member op_Subtraction : ^U * ^U -> ^U))

Adaptively averages the avals mapped from the entries (needs a numeric type with DivideByInt, e.g. float; the AMap counterpart of ASet.averageByA).

mapping : 'K -> 'V -> aval<^U>
mapValue : amap<'K, 'V>
Returns: aval<^U>

bind mapping value

Full Usage: bind mapping value

Parameters:
    mapping : 'T -> amap<'K, 'V>
    value : aval<'T>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'T, 'K, 'V (requires equality)

Adaptively maps over the given value and returns the resulting map (FDA AMap.bind parity; PLAN.md Section 7.4). When the value changes, the whole inner map is swapped: the old content is removed, the inner sink is unregistered eagerly, and mapping selects the new inner map. The inner map's own changes propagate while it is bound.

mapping : 'T -> amap<'K, 'V>
value : aval<'T>
Returns: amap<'K, 'V>
Example

 // a map that follows the currently selected table
 let selected = CVal.create 0
 let tables = [| CMap.empty<string, int>; CMap.empty<string, int> |]
 let visible = AMap.bind (fun i -> tables[i]) (CVal.value selected)
 CMap.addOrUpdate "health" 10 (tables[0])
 CVal.setValue 1 selected
 // visible is now empty, and table 0's later changes do not leak
val selected: obj
val tables: obj array
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
val visible: obj

bind2 mapping a b

Full Usage: bind2 mapping a b

Parameters:
    mapping : 'A -> 'B -> amap<'K, 'V>
    a : aval<'A>
    b : aval<'B>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'A, 'B, 'K, 'V (requires equality)

Adaptively maps over the two values and returns the resulting map (FDA AMap.bind2 parity). When either value changes, the whole inner map is swapped (the bind semantics). Composed as one bind over the mapped pair (the FDA approach: nested binds would miss the inner bind's swap, which signals by version only, not by delta).

mapping : 'A -> 'B -> amap<'K, 'V>
a : aval<'A>
b : aval<'B>
Returns: amap<'K, 'V>

bind3 mapping a b c

Full Usage: bind3 mapping a b c

Parameters:
    mapping : 'A -> 'B -> 'C -> amap<'K, 'V>
    a : aval<'A>
    b : aval<'B>
    c : aval<'C>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'A, 'B, 'C, 'K, 'V (requires equality)

Adaptively maps over the three values and returns the resulting map (FDA AMap.bind3 parity). When any value changes, the whole inner map is swapped (the bind semantics).

mapping : 'A -> 'B -> 'C -> amap<'K, 'V>
a : aval<'A>
b : aval<'B>
c : aval<'C>
Returns: amap<'K, 'V>

choose f mapValue

Full Usage: choose f mapValue

Parameters:
    f : 'K -> 'V -> 'U option
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality)

Maps every entry, keeping only the ones the mapping returns a value for.

f : 'K -> 'V -> 'U option
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

choose2 mapping left right

Full Usage: choose2 mapping left right

Parameters:
    mapping : 'K -> 'V1 option -> 'V2 option -> 'V3 option
    left : amap<'K, 'V1>
    right : amap<'K, 'V2>

Returns: amap<'K, 'V3>
Modifiers: inline
Type parameters: 'K, 'V1, 'V2, 'V3 (requires equality)

Merges both maps with a mapping that receives the key and both side values (voptions) and returns the output value (voption). The mapping is called only when at least one side has a value (FDA parity); a key with no value on either side is removed without a call. Voption-first: this is FDA's choose2V (the option variant is not provided).

mapping : 'K -> 'V1 option -> 'V2 option -> 'V3 option
left : amap<'K, 'V1>
right : amap<'K, 'V2>
Returns: amap<'K, 'V3>

choose2V mapping left right

Full Usage: choose2V mapping left right

Parameters:
    mapping : 'K -> 'V1 voption -> 'V2 voption -> 'V3 voption
    left : amap<'K, 'V1>
    right : amap<'K, 'V2>

Returns: amap<'K, 'V3>
Modifiers: inline
Type parameters: 'K, 'V1, 'V2, 'V3 (requires equality)

Merges both maps with a mapping that receives the key and both side values (voptions) and returns the output value (voption). The mapping is called only when at least one side has a value (FDA parity); a key with no value on either side is removed without a call. Voption-first: this is FDA's choose2V (the option variant is not provided).

mapping : 'K -> 'V1 voption -> 'V2 voption -> 'V3 voption
left : amap<'K, 'V1>
right : amap<'K, 'V2>
Returns: amap<'K, 'V3>

chooseA mapping mapValue

Full Usage: chooseA mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<'U option>
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality)

Adaptively maps every entry of the map to an adaptive value, keeping only the entries whose aval holds Some (FDA AMap.chooseA parity).

mapping : 'K -> 'V -> aval<'U option>
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

chooseAV mapping mapValue

Full Usage: chooseAV mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<'U voption>
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality)

The voption counterpart of chooseA: the mapping returns aval<'U voption> directly, without the option-to-voption wrapper node per entry (the no-allocation path).

mapping : 'K -> 'V -> aval<'U voption>
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

chooseV f mapValue

Full Usage: chooseV f mapValue

Parameters:
    f : 'K -> 'V -> 'U voption
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality)

Maps every entry, keeping only the ones the mapping returns a value for.

f : 'K -> 'V -> 'U voption
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

constant create

Full Usage: constant create

Parameters:
Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive map whose content is fixed but computed lazily, once, at first read. Enables self-referential definitions (FDA parity: the create function runs at most once; deviation: FDA's create returns a HashMap, ours returns a Dictionary).

create : unit -> Dictionary<'K, 'V>
Returns: amap<'K, 'V>

count mapValue

Full Usage: count mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: aval<int>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively gets the number of entries. Incremental: an update of an existing key does not re-evaluate this value or its dependents.

mapValue : amap<'K, 'V>
Returns: aval<int>

countBy predicate mapValue

Full Usage: countBy predicate mapValue

Parameters:
    predicate : 'K -> 'V -> bool
    mapValue : amap<'K, 'V>

Returns: aval<int>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively counts the entries that satisfy the predicate.

predicate : 'K -> 'V -> bool
mapValue : amap<'K, 'V>
Returns: aval<int>

countByA predicate mapValue

Full Usage: countByA predicate mapValue

Parameters:
    predicate : 'K -> 'V -> aval<bool>
    mapValue : amap<'K, 'V>

Returns: aval<int>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively counts the entries whose predicate aval holds true (the AMap counterpart of ASet.countByA).

predicate : 'K -> 'V -> aval<bool>
mapValue : amap<'K, 'V>
Returns: aval<int>

custom compute

Full Usage: custom compute

Parameters:
Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive map driven by a compute function (FDA AMap.custom parity, pull model). The compute receives the current view and a delta builder; it appends the operations that describe the change since the previous call (for example, consuming its own event queue).

compute : IReadOnlyDictionary<'K, 'V> -> MapDeltaBuilder<'K, 'V> -> unit
Returns: amap<'K, 'V>

delay create

Full Usage: delay create

Parameters:
Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Alias of constant (symmetry with ASet.delay; FDA has no AMap.delay).

create : unit -> Dictionary<'K, 'V>
Returns: amap<'K, 'V>

difference left right

Full Usage: difference left right

Parameters:
    left : amap<'K, 'V>
    right : amap<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

The keys present in the left map but not in the right map, with the left values (the AMap counterpart of ASet.difference). Right values are ignored; only the right keys matter.

left : amap<'K, 'V>
right : amap<'K, 'V>
Returns: amap<'K, 'V>

empty

Full Usage: empty

Returns: amap<'K, 'V>
Type parameters: 'K, 'V (requires equality)

An empty adaptive map (FDA AMap.empty parity).

Returns: amap<'K, 'V>

exists predicate mapValue

Full Usage: exists predicate mapValue

Parameters:
    predicate : 'K -> 'V -> bool
    mapValue : amap<'K, 'V>

Returns: aval<bool>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively tests if any entry satisfies the predicate.

predicate : 'K -> 'V -> bool
mapValue : amap<'K, 'V>
Returns: aval<bool>

existsA predicate mapValue

Full Usage: existsA predicate mapValue

Parameters:
    predicate : 'K -> 'V -> aval<bool>
    mapValue : amap<'K, 'V>

Returns: aval<bool>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively tests if any entry's predicate aval holds true (the AMap counterpart of ASet.existsA).

predicate : 'K -> 'V -> aval<bool>
mapValue : amap<'K, 'V>
Returns: aval<bool>

filter predicate mapValue

Full Usage: filter predicate mapValue

Parameters:
    predicate : 'K -> 'V -> bool
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Keeps the entries that satisfy the predicate.

predicate : 'K -> 'V -> bool
mapValue : amap<'K, 'V>
Returns: amap<'K, 'V>

filterA predicate mapValue

Full Usage: filterA predicate mapValue

Parameters:
    predicate : 'K -> 'V -> aval<bool>
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively keeps the entries whose predicate aval holds true (FDA AMap.filterA parity).

predicate : 'K -> 'V -> aval<bool>
mapValue : amap<'K, 'V>
Returns: amap<'K, 'V>

filterV predicate mapValue

Full Usage: filterV predicate mapValue

Parameters:
    predicate : 'V -> bool
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'V, 'K (requires equality)

Keeps the entries whose value satisfies the predicate (FDA AMap.filter' parity; the V suffix is the value-only convention).

predicate : 'V -> bool
mapValue : amap<'K, 'V>
Returns: amap<'K, 'V>

find key mapValue

Full Usage: find key mapValue

Parameters:
    key : 'K
    mapValue : amap<'K, 'V>

Returns: aval<'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively looks up the key. Reading the value throws KeyNotFoundException when the key is absent. Per-key precise, like tryFind.

key : 'K
mapValue : amap<'K, 'V>
Returns: aval<'V>

fold add zero mapValue

Full Usage: fold add zero mapValue

Parameters:
    add : 's -> 'k -> 'v -> 's
    zero : 's
    mapValue : amap<'k, 'v>

Returns: aval<'s>
Modifiers: inline
Type parameters: 's, 'k, 'v (requires equality)

Adaptively folds the map with add; every removal recomputes the whole fold. Use foldGroup when the operation has an inverse.

add : 's -> 'k -> 'v -> 's
zero : 's
mapValue : amap<'k, 'v>
Returns: aval<'s>

foldGroup add subtract zero mapValue

Full Usage: foldGroup add subtract zero mapValue

Parameters:
    add : 's -> 'k -> 'v -> 's
    subtract : 's -> 'k -> 'v -> 's
    zero : 's
    mapValue : amap<'k, 'v>

Returns: aval<'s>
Modifiers: inline
Type parameters: 's, 'k, 'v (requires equality)

Adaptively folds the map with an invertible subtract: removals update the state without a recompute.

add : 's -> 'k -> 'v -> 's
subtract : 's -> 'k -> 'v -> 's
zero : 's
mapValue : amap<'k, 'v>
Returns: aval<'s>

foldHalfGroup add trySubtract zero mapValue

Full Usage: foldHalfGroup add trySubtract zero mapValue

Parameters:
    add : 's -> 'k -> 'v -> 's
    trySubtract : 's -> 'k -> 'v -> 's voption
    zero : 's
    mapValue : amap<'k, 'v>

Returns: aval<'s>
Modifiers: inline
Type parameters: 's, 'k, 'v (requires equality)

Adaptively folds the map with a partially invertible trySubtract: removals that cannot be inverted recompute the whole fold (FDA AMap.foldHalfGroup parity).

add : 's -> 'k -> 'v -> 's
trySubtract : 's -> 'k -> 'v -> 's voption
zero : 's
mapValue : amap<'k, 'v>
Returns: aval<'s>

forall predicate mapValue

Full Usage: forall predicate mapValue

Parameters:
    predicate : 'K -> 'V -> bool
    mapValue : amap<'K, 'V>

Returns: aval<bool>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively tests if every entry satisfies the predicate.

predicate : 'K -> 'V -> bool
mapValue : amap<'K, 'V>
Returns: aval<bool>

forallA predicate mapValue

Full Usage: forallA predicate mapValue

Parameters:
    predicate : 'K -> 'V -> aval<bool>
    mapValue : amap<'K, 'V>

Returns: aval<bool>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively tests if every entry's predicate aval holds true (the AMap counterpart of ASet.forallA).

predicate : 'K -> 'V -> aval<bool>
mapValue : amap<'K, 'V>
Returns: aval<bool>

force mapValue

Full Usage: force mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: FrozenDictionary<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Materializes the current state as an immutable FrozenDictionary<'K,'V>. This is the only collection operation that allocates; the result is safe to retain and the library never touches it again. Runs the pending delta processing (drain) first.

mapValue : amap<'K, 'V>
Returns: FrozenDictionary<'K, 'V>

getValue mapValue

Full Usage: getValue mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: IReadOnlyDictionary<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Returns a transient view of the current state. Valid only until the next write on the owner thread; do not retain or mutate it. Use force to materialize a snapshot that is safe to retain.

mapValue : amap<'K, 'V>
Returns: IReadOnlyDictionary<'K, 'V>

groupBy keyOf mapValue

Full Usage: groupBy keyOf mapValue

Parameters:
    keyOf : 'K -> 'V -> 'G
    mapValue : amap<'K, 'V>

Returns: amap<'G, amap<'K, 'V>>
Modifiers: inline
Type parameters: 'K, 'V, 'G (requires equality and equality)

Groups the entries of a map by a computed key (FDA AMap.groupBy parity). The output entries are live adaptive maps: the per-group content follows the source adaptively, and the groups' own changes reach the consumers without re-reading the whole map. A group disappears when it becomes empty (removed at the next drain); a key whose value changes group is moved between groups.

keyOf : 'K -> 'V -> 'G
mapValue : amap<'K, 'V>
Returns: amap<'G, amap<'K, 'V>>
Example

 // documents grouped by author; the per-author map stays live
 let byAuthor = AMap.groupBy (fun _ doc -> doc.Author) documents
 // adaptively count each author
 let counts =
     byAuthor
     |> AMap.mapA (fun _ group -> AMap.count group)
val byAuthor: obj
val counts: obj

intersect left right

Full Usage: intersect left right

Parameters:
    left : amap<'K, 'V1>
    right : amap<'K, 'V2>

Returns: amap<'K, ('V1 * 'V2)>
Modifiers: inline
Type parameters: 'K, 'V1, 'V2 (requires equality)

The keys present in both maps, with the values paired. Struct pair: the voption-first convention collapses FDA's intersect (tuple) and intersectV (struct) into the struct form.

left : amap<'K, 'V1>
right : amap<'K, 'V2>
Returns: amap<'K, ('V1 * 'V2)>

intersectV left right

Full Usage: intersectV left right

Parameters:
    left : amap<'K, 'V1>
    right : amap<'K, 'V2>

Returns: amap<'K, ('V1 * 'V2)>
Modifiers: inline
Type parameters: 'K, 'V1, 'V2 (requires equality)

Alias of intersect (FDA parity name; our intersect is already the struct-pair form, gap sheet §4.6).

left : amap<'K, 'V1>
right : amap<'K, 'V2>
Returns: amap<'K, ('V1 * 'V2)>

intersectWith combine left right

Full Usage: intersectWith combine left right

Parameters:
    combine : 'K -> 'V1 -> 'V2 -> 'V3
    left : amap<'K, 'V1>
    right : amap<'K, 'V2>

Returns: amap<'K, 'V3>
Modifiers: inline
Type parameters: 'K, 'V1, 'V2, 'V3 (requires equality)

Intersects both maps, combining the paired values.

combine : 'K -> 'V1 -> 'V2 -> 'V3
left : amap<'K, 'V1>
right : amap<'K, 'V2>
Returns: amap<'K, 'V3>

isEmpty mapValue

Full Usage: isEmpty mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: aval<bool>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively tests if the map is empty. Incremental: only a change that crosses the empty/non-empty boundary re-evaluates this value or its dependents.

mapValue : amap<'K, 'V>
Returns: aval<bool>

joinOn left right keyOfLeft mapping

Full Usage: joinOn left right keyOfLeft mapping

Parameters:
    left : amap<'K1, 'V1>
    right : amap<'K2, 'V2>
    keyOfLeft : 'K1 -> 'V1 -> 'K2
    mapping : 'K1 -> aval<'V1> -> aval<'V2 voption> -> aval<'U voption>

Returns: amap<'K1, 'U>
Modifiers: inline
Type parameters: 'K1, 'V1, 'K2, 'V2, 'U (requires equality and equality)

Equi-joins two maps on a computed key (the map analog of AVal.map2). The left map is enumerated per key; the join key is computed from the left entry; the right map is looked up per entry (never enumerated or rebuilt). The mapping receives the left key, the left value as an adaptive value, and the right-side value (or ValueNone when the join key is absent), and returns the output aval; a ValueNone output drops the entry (choose semantics). Output entries are keyed by the left key.

The per-key subgraph is built once and updated in place: a left update re-applies a swappable value cell (no rebuild, no per-frame allocation), and a join-key change (rare) re-runs the mapping against the new lookup. Right-map changes reach the entries through the lookup (read-time gate) on the next read. A left-join is the ValueNone case of the mapping; an inner join drops the entry when the right side is ValueNone. Argument order: the two maps come first, so the lambdas elaborate after the map types are pinned — a record-field access in keyOfLeft or the mapping resolves against the actual map types, not the first record in scope with a matching field. The pipe form does not apply: a piped value lands in the mapping slot, a compile error. Performance guidance for hot per-key subgraphs (docs/2026-08-10-JOIN- DESIGN.md §6): the per-key subgraph is forced per updated key per read. A coarser join key reduces the entry count, the direct lever. A static- input subgraph with same-typed inputs is cheaper on a fixed-dependency node (AVal.mapN/AVal.reduce) than on the general node (~40% measured on the recompute); heterogeneous inputs (this mapping's cell + lookup) have no fixed-dependency combinator yet. Batching the left-map writes of one frame in Transaction.run cuts the write-side cost; a clean read (no write since the last read) costs nothing.

left : amap<'K1, 'V1>
right : amap<'K2, 'V2>
keyOfLeft : 'K1 -> 'V1 -> 'K2
mapping : 'K1 -> aval<'V1> -> aval<'V2 voption> -> aval<'U voption>
Returns: amap<'K1, 'U>
Example

 // orders join their product's current price; a product removed from
 // the catalog falls back to the price stored on the order
 let orderViews =
     AMap.joinOn
         orders
         products
         (fun _ order -> order.ProductId)
         (fun _ orderV priceV ->
             AVal.map2
                 (fun order price ->
                     ValueSome
                         { Order = order
                           Price = price |> ValueOption.defaultValue order.StoredPrice })
                 orderV
                 priceV)
val orderViews: obj
union case ValueOption.ValueSome: 'T -> ValueOption<'T>
Multiple items
module ValueOption from Microsoft.FSharp.Core

--------------------
type ValueOption<'T> = | ValueNone | ValueSome of 'T static member Some: value: 'T -> 'T voption static member op_Implicit: value: 'T -> 'T voption member IsNone: bool member IsSome: bool member Value: 'T static member None: 'T voption
val defaultValue: value: 'T -> voption: 'T voption -> 'T

keys mapValue

Full Usage: keys mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: aset<'K>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive set of the map's keys (gap sheet §4.14).

mapValue : amap<'K, 'V>
Returns: aset<'K>

map f mapValue

Full Usage: map f mapValue

Parameters:
    f : 'K -> 'V -> 'U
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality)

Maps every entry of the map.

f : 'K -> 'V -> 'U
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

mapA mapping mapValue

Full Usage: mapA mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<'U>
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality)

Adaptively maps every entry of the map to an adaptive value (FDA AMap.mapA parity). The output follows the aval returned for each entry; writes to the avals deliver targeted deltas.

mapping : 'K -> 'V -> aval<'U>
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

mapSet mapping set

Full Usage: mapSet mapping set

Parameters:
    mapping : 'K -> 'V
    set : aset<'K>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Maps the keys of a set to entries (FDA mapSet parity: the mapping runs per key).

mapping : 'K -> 'V
set : aset<'K>
Returns: amap<'K, 'V>

mapUse mapping mapValue

Full Usage: mapUse mapping mapValue

Parameters:
    mapping : 'K -> 'V -> 'W
    mapValue : amap<'K, 'V>

Returns: IDisposable * amap<'K, 'W>
Modifiers: inline
Type parameters: 'K, 'V, 'W (requires equality and equality and :> System.IDisposable)

Maps every entry, disposing the mapped value when its key leaves (FDA AMap.mapUse parity). The mapped values are stable (the mapping runs once per key). Disposing the returned disposable disposes all live mapped values and clears the output map.

mapping : 'K -> 'V -> 'W
mapValue : amap<'K, 'V>
Returns: IDisposable * amap<'K, 'W>
Example

 let src = CMap.ofSeq [ 1, "a"; 2, "b" ]
 let cleanup, mapped = src |> AMap.mapUse (fun id _ -> Resource(id))
 CMap.remove 1 src              // the resource for key 1 is disposed
 cleanup.Dispose()              // all remaining resources are disposed
val src: obj
val cleanup: obj
val mapped: obj
val id: x: 'T -> 'T

mapV f mapValue

Full Usage: mapV f mapValue

Parameters:
    f : 'V -> 'U
    mapValue : amap<'K, 'V>

Returns: amap<'K, 'U>
Modifiers: inline
Type parameters: 'V, 'U, 'K (requires equality)

Maps the values only (FDA AMap.map' parity; the V suffix is the value-only convention).

f : 'V -> 'U
mapValue : amap<'K, 'V>
Returns: amap<'K, 'U>

ofAList list

Full Usage: ofAList list

Parameters:
Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive map of a list of entries (FDA AMap.ofAList parity). Duplicate keys: the last entry wins.

list : alist<'K * 'V>
Returns: amap<'K, 'V>

ofASet elements

Full Usage: ofASet elements

Parameters:
    elements : aset<'K * 'V>

Returns: amap<'K, HashSet<'V>>
Modifiers: inline
Type parameters: 'K, 'V (requires equality and equality)

A map from a set of entries, keeping ALL values of a key in a HashSet (FDA ofASet parity). A changed value set emits a fresh HashSet in the delta (this node allocates by design).

elements : aset<'K * 'V>
Returns: amap<'K, HashSet<'V>>

ofASetIgnoreDuplicates elements

Full Usage: ofASetIgnoreDuplicates elements

Parameters:
    elements : aset<'K * 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality and equality)

A map from a set of entries; duplicate keys keep the LAST value (FDA ofASetIgnoreDuplicates parity: the constant path keeps the last value, the delta path is arbitrary).

elements : aset<'K * 'V>
Returns: amap<'K, 'V>

ofASetMapped getKey elements

Full Usage: ofASetMapped getKey elements

Parameters:
    getKey : 'V -> 'K
    elements : aset<'V>

Returns: amap<'K, HashSet<'V>>
Modifiers: inline
Type parameters: 'V, 'K (requires equality and equality)

A map from a set, deriving the key from every value and keeping ALL values of a key in a HashSet (FDA ofASetMapped parity).

getKey : 'V -> 'K
elements : aset<'V>
Returns: amap<'K, HashSet<'V>>

ofASetMappedIgnoreDuplicates getKey elements

Full Usage: ofASetMappedIgnoreDuplicates getKey elements

Parameters:
    getKey : 'V -> 'K
    elements : aset<'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'V, 'K (requires equality and equality)

A map from a set, deriving the key from every value; duplicate keys keep the LAST value.

getKey : 'V -> 'K
elements : aset<'V>
Returns: amap<'K, 'V>

ofAVal value

Full Usage: ofAVal value

Parameters:
Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V, 'S (requires equality and :> ('K * 'V) Microsoft.FSharp.Collections.seq)

An adaptive map over an adaptive value of a sequence of entries. Every change of the value replaces the whole state and emits the diff as the delta (FDA AMap.ofAVal parity; the value carries no deltas).

value : aval<'S>
Returns: amap<'K, 'V>

ofArray items

Full Usage: ofArray items

Parameters:
    items : ('K * 'V)[]

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive map over a fixed array of entries.

items : ('K * 'V)[]
Returns: amap<'K, 'V>

ofExternal snapshot

Full Usage: ofExternal snapshot

Parameters:
Returns: amap<'K, 'V> * (unit -> unit)
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Creates an adaptive map from an external snapshot function and an invalidate handle (FDA AMap.ofExternal parity, MAPA-DESIGN §1.1). The snapshot runs at most once per invalidate, on the next read, and is diffed against the previous snapshot (equal values elided); not invalidated → reads are O(1) and allocate nothing. The handle is O(1) to call and thread-safe (a foreign-thread call is posted to the owner context and applied at the next graph operation).

snapshot : unit -> IReadOnlyDictionary<'K, 'V>
Returns: amap<'K, 'V> * (unit -> unit)
Example

 let mutable current = dict [ 1, "a" ]
 let map, invalidate = AMap.ofExternal (fun () -> current :> IReadOnlyDictionary<_, _>)
 current <- dict [ 1, "a"; 2, "b" ]
 invalidate ()
 let forced = AMap.force map   // [ 1, "a"; 2, "b" ]
val mutable current: System.Collections.Generic.IDictionary<int,string>
val dict: keyValuePairs: ('Key * 'Value) seq -> System.Collections.Generic.IDictionary<'Key,'Value> (requires equality)
val map: obj
val invalidate: (unit -> obj)
val forced: obj

ofList items

Full Usage: ofList items

Parameters:
    items : ('K * 'V) list

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive map over a fixed list of entries.

items : ('K * 'V) list
Returns: amap<'K, 'V>

ofMap items

Full Usage: ofMap items

Parameters:
    items : Map<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires comparison)

An adaptive map over a fixed F# Map.

items : Map<'K, 'V>
Returns: amap<'K, 'V>

ofSeq items

Full Usage: ofSeq items

Parameters:
    items : ('K * 'V) seq

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive map over fixed, immutable entries.

items : ('K * 'V) seq
Returns: amap<'K, 'V>

reduce reduction mapValue

Full Usage: reduce reduction mapValue

Parameters:
Returns: aval<'v>
Modifiers: inline
Type parameters: 'a, 's, 'v, 'k (requires equality)

Adaptively reduces the map with the given AdaptiveReduction over the values. The state is updated incrementally from deltas: a Set on an existing key subtracts the old value, then adds the new one.

reduction : AdaptiveReduction<'a, 's, 'v>
mapValue : amap<'k, 'a>
Returns: aval<'v>

reduceBy reduction mapping mapValue

Full Usage: reduceBy reduction mapping mapValue

Parameters:
Returns: aval<'v>
Modifiers: inline
Type parameters: 'b, 's, 'v, 'k, 'a (requires equality)

Maps every entry, then reduces the mapped values with the given AdaptiveReduction. The mapping runs per delta entry.

reduction : AdaptiveReduction<'b, 's, 'v>
mapping : 'k -> 'a -> 'b
mapValue : amap<'k, 'a>
Returns: aval<'v>

reduceByA reduction mapping mapValue

Full Usage: reduceByA reduction mapping mapValue

Parameters:
Returns: aval<'v>
Modifiers: inline
Type parameters: 'U, 's, 'v, 'K, 'V (requires equality)

Adaptively reduces the map after mapping every entry to an adaptive value (the AMap counterpart of ASet.reduceByA). The mapping produces distinct pairs struct (k, x), so duplicate mapped values keep their multiplicity (a plain mapA would deduplicate them); the reduction projects the value side.

reduction : AdaptiveReduction<'U, 's, 'v>
mapping : 'K -> 'V -> aval<'U>
mapValue : amap<'K, 'V>
Returns: aval<'v>

single key value

Full Usage: single key value

Parameters:
    key : 'K
    value : 'V

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

A constant map with a single entry.

key : 'K
value : 'V
Returns: amap<'K, 'V>

sumBy mapping mapValue

Full Usage: sumBy mapping mapValue

Parameters:
    mapping : 'k -> 'v -> ^u
    mapValue : amap<'k, 'v>

Returns: aval<^u>
Modifiers: inline
Type parameters: 'k, 'v, ^u (requires equality and (static member get_Zero : -> ^u) and (static member op_Addition : ^u * ^u -> ^u) and (static member op_Subtraction : ^u * ^u -> ^u))

Adaptively sums the mapped entries (FDA AMap.sumBy parity).

mapping : 'k -> 'v -> ^u
mapValue : amap<'k, 'v>
Returns: aval<^u>

sumByA mapping mapValue

Full Usage: sumByA mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<^U>
    mapValue : amap<'K, 'V>

Returns: aval<^U>
Modifiers: inline
Type parameters: 'K, 'V, ^U (requires equality and (static member get_Zero : -> ^U) and (static member op_Addition : ^U * ^U -> ^U) and (static member op_Subtraction : ^U * ^U -> ^U))

Adaptively sums the avals mapped from the entries (the AMap counterpart of ASet.sumByA).

mapping : 'K -> 'V -> aval<^U>
mapValue : amap<'K, 'V>
Returns: aval<^U>

toAList mapValue

Full Usage: toAList mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: alist<'K * 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

An adaptive list of the map's entries (FDA AMap.toAList parity, poll node). The order is the map's iteration order, stable while the map does not change.

mapValue : amap<'K, 'V>
Returns: alist<'K * 'V>

toASet mapValue

Full Usage: toASet mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: aset<'K * 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality and equality)

An adaptive set of the map's key/value pairs (FDA AMap.toASet parity, gap sheet §4.14). Struct pairs: the library convention (cf. intersect). The former keys behavior moved to keys.

mapValue : amap<'K, 'V>
Returns: aset<'K * 'V>

toASetValues mapValue

Full Usage: toASetValues mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: aset<'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality and equality)

An adaptive set of the map's distinct values (FDA toASetValues parity).

mapValue : amap<'K, 'V>
Returns: aset<'V>

toAVal mapValue

Full Usage: toAVal mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: aval<FrozenDictionary<'K, 'V>>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Materializes the map as an adaptive value. Every change materializes a new immutable FrozenDictionary<'K,'V> (the retain boundary, like force); the value is safe to retain.

mapValue : amap<'K, 'V>
Returns: aval<FrozenDictionary<'K, 'V>>

toMap mapValue

Full Usage: toMap mapValue

Parameters:
    mapValue : amap<'K, 'V>

Returns: Map<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires comparison)

Materializes the F# Map counterpart (sorted, structural equality).

mapValue : amap<'K, 'V>
Returns: Map<'K, 'V>

tryFind key mapValue

Full Usage: tryFind key mapValue

Parameters:
    key : 'K
    mapValue : amap<'K, 'V>

Returns: aval<'V voption>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Adaptively looks up the key: the value, or ValueNone when the key is absent. The lookup is per-key precise (O(1) on read) for a direct changeable source: a write to an unrelated key does not re-evaluate this value or its dependents. On a derived source the branch re-evaluates at most once per upstream change (pull-lazy: the per-key gate runs at the next read's drain).

key : 'K
mapValue : amap<'K, 'V>
Returns: aval<'V voption>

tryMaxA mapping mapValue

Full Usage: tryMaxA mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<'U>
    mapValue : amap<'K, 'V>

Returns: aval<'U voption>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality and comparison)

Adaptively gets the maximum of the avals mapped from the entries, or ValueNone when empty (the voption counterpart of the *A family; AMap has no plain tryMax, this mirrors the ASet/AList members for family symmetry).

mapping : 'K -> 'V -> aval<'U>
mapValue : amap<'K, 'V>
Returns: aval<'U voption>

tryMinA mapping mapValue

Full Usage: tryMinA mapping mapValue

Parameters:
    mapping : 'K -> 'V -> aval<'U>
    mapValue : amap<'K, 'V>

Returns: aval<'U voption>
Modifiers: inline
Type parameters: 'K, 'V, 'U (requires equality and comparison)

Adaptively gets the minimum of the avals mapped from the entries, or ValueNone when empty (the voption counterpart of the *A family; AMap has no plain tryMin, this mirrors the ASet/AList members for family symmetry).

mapping : 'K -> 'V -> aval<'U>
mapValue : amap<'K, 'V>
Returns: aval<'U voption>

union left right

Full Usage: union left right

Parameters:
    left : amap<'K, 'V>
    right : amap<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Unions both maps, preferring the RIGHT value when keys collide (FDA parity: union a b = unionWith (fun _ _ r -> r) a b).

left : amap<'K, 'V>
right : amap<'K, 'V>
Returns: amap<'K, 'V>

unionWith resolve left right

Full Usage: unionWith resolve left right

Parameters:
    resolve : 'K -> 'V -> 'V -> 'V
    left : amap<'K, 'V>
    right : amap<'K, 'V>

Returns: amap<'K, 'V>
Modifiers: inline
Type parameters: 'K, 'V (requires equality)

Unions both maps, resolving colliding keys with the given function.

resolve : 'K -> 'V -> 'V -> 'V
left : amap<'K, 'V>
right : amap<'K, 'V>
Returns: amap<'K, 'V>

Type something to start searching.