LookupArray Module
A growable, index-addressed store: items are added in creation order, each one stamped with
the index it was stored at, and read back by that index.
It exists because the simulator's build phase was indexing its own components by structural
keys. A `Map
Types
| Type | Description |
Functions and values
| Function or value | Description |
|
Add an item, stamping it with the index it is stored at. **Use the returned item, never the argument.** With an in-place stamp the two are the same object and with a lens they are not, so `addItem x store |> ignore` is correct in one flavour and silently wrong in the other. The compiler cannot tell them apart.
|
Full Usage:
count store
Parameters:
LookupArray<'T>
Returns: int
Modifiers: inline Type parameters: 'T |
|
Full Usage:
create getIndex addIndexStamp capacity maxIncrement
Parameters:
'T -> int
addIndexStamp : 'T -> int -> 'T
capacity : int
maxIncrement : int
Returns: LookupArray<'T>
|
A store of `capacity` items before it has to grow, extending by at most `maxIncrement` slots at a time once it does. The two functions are given separately rather than as a `Lens<'T,int>` so that the caller chooses what stamping costs. A lens setter is a record copy, and the simulator's use of this stores a 24-field record created hundreds of thousands of times per build - while that record is `[
|
Full Usage:
indexOf item store
Parameters:
'T
store : LookupArray<'T>
Returns: int
Modifiers: inline Type parameters: 'T |
|
Full Usage:
item i store
Parameters:
int
store : LookupArray<'T>
Returns: 'T
Modifiers: inline Type parameters: 'T |
|
|
|
|
|
|
|