Logo Mibo

ChangeableList<'T> Type

A changeable list: the writable source of an adaptive list. Reads and writes are confined to the owner thread. See ChangeableSet<'T> for the view, transaction, and disposal contracts.

Positions are 0-based and refer to the list as of the previous operation of the same batch. A full replace (Set) inside a transaction is last-wins over the whole batch: it supersedes all other writes of the batch (docs/ALIST-DESIGN.md §3.3). Reads inside a transaction see the pre-transaction list, so positions inside a transaction refer to the pre-transaction list.

GetValue returns a transient view of the internal list, valid only until the next write. CList.force materializes an immutable array snapshot.

Constructors

Constructor Description

ChangeableList(initial)

Full Usage: ChangeableList(initial)

Parameters:
    initial : 'T seq

Returns: ChangeableList<'T>
initial : 'T seq
Returns: ChangeableList<'T>

Instance members

Instance member Description

this.Append

Full Usage: this.Append

Parameters:
    value : 'T

Appends an element at the end of the list.

value : 'T

this.Clear

Full Usage: this.Clear

Removes all elements. The delta carries descending removes.

this.Count

Full Usage: this.Count

Returns: int

Gets the number of elements.

Returns: int

this.InsertAt

Full Usage: this.InsertAt

Parameters:
    position : int
    value : 'T

Inserts an element before the element currently at position. position = Count appends. Throws when out of range.

position : int
value : 'T

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

Gets whether the list is empty.

Returns: bool

this[position]

Full Usage: this[position]

Parameters:
    position : int

Returns: 'T

Gets the element at the given position.

position : int
Returns: 'T

this.PostAppend

Full Usage: this.PostAppend

Parameters:
    value : 'T

Posts an append. Safe from any thread: the operation is queued and returns immediately. The owner thread applies the queued operations at the next graph operation (reads and writes auto-drain) or at Posting.pump, as one batch: one delta, one notification delivery, and a burst is coalesced into a single handoff. Positions of the batch refer to the state built by its earlier ops.

value : 'T
Example

 // worker thread
 CList.postAppend item items
 // owner thread: the next read applies the post automatically
 let view = AList.force items
val view: obj

this.PostClear

Full Usage: this.PostClear

Posts a clear. Safe from any thread. See PostAppend for the application contract.

Example

 // worker thread
 CList.postClear items

this.PostInsertAt

Full Usage: this.PostInsertAt

Parameters:
    position : int
    value : 'T

Posts an insert before the element currently at the position. Safe from any thread. See PostAppend for the application contract; the position is validated when the batch applies and refers to the state built by the earlier ops of the batch.

position : int
value : 'T
Example

 // worker thread
 CList.postInsertAt 0 item items

this.PostPrepend

Full Usage: this.PostPrepend

Parameters:
    value : 'T

Posts an insert at the start. Safe from any thread. See PostAppend for the application contract.

value : 'T
Example

 // worker thread
 CList.postPrepend item items

this.PostRemove

Full Usage: this.PostRemove

Parameters:
    value : 'T

Posts a remove of the first occurrence of the value. Safe from any thread. See PostAppend for the application contract; the scan runs when the batch applies.

value : 'T
Example

 // worker thread
 CList.postRemove item items

this.PostRemoveAt

Full Usage: this.PostRemoveAt

Parameters:
    position : int

Posts a remove at the position. Safe from any thread. See PostAppend for the application contract; the position is validated when the batch applies.

position : int
Example

 // worker thread
 CList.postRemoveAt 0 items

this.PostSet

Full Usage: this.PostSet

Parameters:
    newValues : 'T seq

Posts a full replace. Safe from any thread. See PostAppend for the application contract; a posted replace supersedes the other ops of the same pending batch (the transaction semantics of Set).

newValues : 'T seq
Example

 // worker thread
 CList.postSet [ 1; 2; 3 ] items

this.PostUpdateAt

Full Usage: this.PostUpdateAt

Parameters:
    position : int
    value : 'T

Posts a replace at the position. Safe from any thread. See PostAppend for the application contract; the position is validated when the batch applies.

position : int
value : 'T
Example

 // worker thread
 CList.postUpdateAt 0 item items

this.Prepend

Full Usage: this.Prepend

Parameters:
    value : 'T

Inserts an element at the start of the list.

value : 'T

this.Remove

Full Usage: this.Remove

Parameters:
    value : 'T

Removes the first occurrence of the value. No-op when absent. O(n) write-time scan.

value : 'T

this.RemoveAt

Full Usage: this.RemoveAt

Parameters:
    position : int

Removes the element currently at position. Throws when out of range.

position : int

this.Set

Full Usage: this.Set

Parameters:
    newValues : 'T seq

Replaces the whole list (prefix/suffix-trim diff). Last-wins over the whole batch inside a transaction: it supersedes all other writes of the batch (docs/ALIST-DESIGN.md ยง3.3).

newValues : 'T seq

this.TryGet

Full Usage: this.TryGet

Parameters:
    position : int

Returns: 'T voption

Gets the element at the given position, or ValueNone when out of range.

position : int
Returns: 'T voption

this.UpdateAt

Full Usage: this.UpdateAt

Parameters:
    position : int
    value : 'T

Replaces the element currently at position. No-op when the value is equal (equality at the source). Throws when out of range.

position : int
value : 'T

Type something to start searching.