~/bend-docscommunity

src/containers/intrusive_doubly_linked_list.bend checks

raw source on the hub · import bend-collections-laws-containers@1.0.0.0/src/containers/intrusive_doubly_linked_list.bend as Intrusive_doubly_linked_list

Generated by tools/generators/intrusive_list.py; edit that source.

3 imports
import Base
import ./internal/intrusive_list.bend as Impl
import ./types/intrusive_doubly_linked_list.bend as E

Templates

template next source · line 12 · raw

@-S:Type -> @-N:Data -> @-next_of:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @s:S -> @+node:N -> Pair(S, Maybe<&2, N>)

Read the next identity without changing membership.

template prev source · line 16 · raw

@-S:Type -> @-N:Data -> @-prev_of:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @s:S -> @+node:N -> Pair(S, Maybe<&2, N>)

Read the previous identity without changing membership.

template value source · line 20 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-value_of:(@_:S -> @_:N -> Pair(S, V)) -> @s:S -> @+node:N -> Pair(S, V)

Observe a Data value (often the entity identity); payload ownership stays in S.

template get_head source · line 24 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @s:S -> @+h:H -> Pair(S, Maybe<&2, N>)

Read a root; requires no writer context.

template remove source · line 29 · raw

@-S:Type -> @-N:Data -> @-I:Data -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:I -> @_:Maybe<&2, N> -> S) -> @s:S -> @+i:I -> @+node:N -> S

Detach a known member in O(1). Uses the nullable root setter only for a head. Requires no root reader; preserves the node identity and payload.

template prepend_as source · line 34 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-I:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head_nonempty:(@_:S -> @_:I -> @_:N -> S) -> @s:S -> @+h:H -> @+i:I -> @+node:N -> S

Prepend a detached node in O(1), using separate read/write contexts. Calls the nonempty root setter exactly once.

template prepend source · line 38 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head_nonempty:(@_:S -> @_:H -> @_:N -> S) -> @s:S -> @+h:H -> @+node:N -> S

Prepend with the same context used to read and write the root.

template is_empty source · line 42 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @s:S -> @+h:H -> Pair(S, Bool)

O(1) empty-root query.

template non_empty source · line 46 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @s:S -> @+h:H -> Pair(S, Bool)

O(1) nonempty-root query.

template at_least_two source · line 50 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @s:S -> @+h:H -> Pair(S, Bool)

O(1) query: head exists and has a successor.

template fold_left source · line 54 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-A:Type -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-fn:(@_:S -> @_:C -> @_:A -> @_:V -> Pair(S, A)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> @acc:A -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, A>)

Forward fold, saving next before each callback. The accumulator may own Type data.

template foreach source · line 58 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-fn:(@_:S -> @_:C -> @_:V -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Forward visit, saving next before each callback; removing current is supported.

template find source · line 62 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Maybe<&2, N>>)

Return the first matching node identity; next is read after a failed predicate.

template find_some_this source · line 66 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Maybe<&2, N>>)

Compatibility alias of find; Bend needs no preallocated Option wrapper.

template exists source · line 70 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Bool>)

Short-circuit on the first true predicate; False for an empty list.

template forall source · line 74 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Bool>)

Short-circuit on the first false predicate; True for an empty list.

template count source · line 78 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Nat>)

Count matching values; read next after each predicate. O(n).

template length source · line 82 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @+fuel:Nat -> @s:S -> @+h:H -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Nat>)

Count members in O(n); no cached count is required in the root.

template find_convert source · line 86 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-convert:(@_:S -> @_:V -> Pair(S, Maybe<&2, D>)) -> @-pred:(@_:S -> @_:C -> @_:D -> Pair(S, Bool)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Maybe<&2, N>>)

Convert once per visited value, skip failed conversions, return the original node.

template find_value source · line 90 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-eq:(@_:V -> @_:V -> Bool) -> @+fuel:Nat -> @s:S -> @+h:H -> @+wanted:V -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Maybe<&2, N>>)

Find with eq(wanted, observed_value), returning the node identity.

template find_value_convert source · line 94 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-convert:(@_:S -> @_:V -> Pair(S, Maybe<&2, D>)) -> @-eq:(@_:D -> @_:D -> Bool) -> @+fuel:Nat -> @s:S -> @+h:H -> @+wanted:D -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Maybe<&2, N>>)

Find with eq(converted_value, wanted), returning the original node.

template clear_list_as source · line 99 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-I:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:I -> @_:Maybe<&2, N> -> S) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+i:I -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Preflight the bound, publish an empty root, detach suffix then original head. Call post_remove once per detached node; a no-op callback needs no allocation.

template clear_list source · line 103 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:H -> @_:Maybe<&2, N> -> S) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Clear using one root context; see clear_list_as for callback order.

template clear_list_with_pool_as source · line 108 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-I:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:I -> @_:Maybe<&2, N> -> S) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+i:I -> @+pool:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Clear using a callback that returns each detached node to an application pool. The pool argument locates that pool in S; post_remove performs the free.

template clear_list_with_pool source · line 112 · raw

@-S:Type -> @-N:Data -> @-H:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:H -> @_:Maybe<&2, N> -> S) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+pool:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Clear to a pool using one root context.

template foreach_remove_filter_as source · line 117 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-H:Data -> @-I:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:I -> @_:Maybe<&2, N> -> S) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+i:I -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Keep true values, detach false values, then call post_remove on the removed node. Re-read the live head in the prefix; save next when visiting the retained tail.

template foreach_remove_filter source · line 121 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-H:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:H -> @_:Maybe<&2, N> -> S) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-pred:(@_:S -> @_:C -> @_:V -> Pair(S, Bool)) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Removal filter with one root context.

template foreach_remove_convert_filter_as source · line 125 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-H:Data -> @-I:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:I -> @_:Maybe<&2, N> -> S) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-convert:(@_:S -> @_:V -> Pair(S, Maybe<&2, D>)) -> @-pred:(@_:S -> @_:C -> @_:D -> Pair(S, Bool)) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+i:I -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Remove failed conversions and false predicates; convert each visited value once.

template foreach_remove_convert_filter source · line 129 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-H:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:H -> @_:Maybe<&2, N> -> S) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-convert:(@_:S -> @_:V -> Pair(S, Maybe<&2, D>)) -> @-pred:(@_:S -> @_:C -> @_:D -> Pair(S, Bool)) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Conversion/removal filter with one root context.

template foreach_remove_convert_as source · line 133 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-H:Data -> @-I:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:I -> @_:Maybe<&2, N> -> S) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-convert:(@_:S -> @_:V -> Pair(S, Maybe<&2, D>)) -> @-fn:(@_:S -> @_:C -> @_:D -> S) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+i:I -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Visit successfully converted values, remove failed conversions.

template foreach_remove_convert source · line 137 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-H:Data -> @-C:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_head:(@_:S -> @_:H -> @_:Maybe<&2, N> -> S) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-convert:(@_:S -> @_:V -> Pair(S, Maybe<&2, D>)) -> @-fn:(@_:S -> @_:C -> @_:D -> S) -> @-post_remove:(@_:S -> @_:C -> @_:N -> S) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, Unit>)

Conversion/removal visitor with one root context.

template flat_map_to_list source · line 142 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-T:Type -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-fn:(@_:S -> @_:C -> @_:V -> Pair(S, Maybe<&1, T>)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, List<&1, T>>)

Option filter-map: zero or one output per input. Callbacks run tail to head; the newly allocated owning result list retains forward input order.

template map_to_list source · line 146 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-T:Type -> @-C:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @-fn:(@_:S -> @_:C -> @_:V -> Pair(S, T)) -> @+fuel:Nat -> @s:S -> @+h:H -> @+c:C -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, List<&1, T>>)

Allocate a result list in forward order; evaluate callbacks tail to head.

template to_list source · line 150 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-H:Data -> @-get_head:(@_:S -> @_:H -> Pair(S, Maybe<&2, N>)) -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-prev:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-value:(@_:S -> @_:N -> Pair(S, V)) -> @+fuel:Nat -> @s:S -> @+h:H -> Pair(S, Result<&2, &1, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Error, List<&1, V>>)

Allocate an owning list of observed values in forward order.

template from_values source · line 155 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-make:(@_:S -> @_:C -> @_:V -> Pair(S, N)) -> @s:S -> @+xs:List<&2, V> -> @+c:C -> Pair(S, Maybe<&2, N>)

Build from values in forward order using an application factory; return the head. Factories must return distinct detached nodes. The root is not published here.

template from_nodes source · line 159 · raw

@-S:Type -> @-N:Data -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @s:S -> @+xs:List<&2, N> -> Pair(S, Maybe<&2, N>)

Link distinct detached nodes in input order; return the head without allocating nodes.

template map_from_values source · line 163 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-D:Data -> @-C:Data -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-convert:(@_:S -> @_:C -> @_:V -> Pair(S, D)) -> @-make:(@_:S -> @_:C -> @_:D -> Pair(S, N)) -> @s:S -> @+xs:List<&2, V> -> @+c:C -> Pair(S, Maybe<&2, N>)

Convert then construct each node, both in forward order; return the head.

template map_from_nodes source · line 167 · raw

@-S:Type -> @-N:Data -> @-V:Data -> @-C:Data -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-set_prev:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-make:(@_:S -> @_:C -> @_:V -> Pair(S, N)) -> @s:S -> @+xs:List<&2, V> -> @+c:C -> Pair(S, Maybe<&2, N>)

Map each input to a detached node in forward order; return the head.

template pool_free source · line 171 · raw

@-S:Type -> @-N:Data -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @s:S -> @pool:0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Pool<N> -> @+node:N -> Pair(S, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Pool<N>)

Push a detached node onto the LIFO pool; leave its payload unchanged. O(1).

template pool_next source · line 175 · raw

@-S:Type -> @-N:Data -> @-C:Data -> @-next:(@_:S -> @_:N -> Pair(S, Maybe<&2, N>)) -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-make:(@_:S -> @_:C -> Pair(S, N)) -> @s:S -> @pool:0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Pool<N> -> @+c:C -> Pair(S, Pair(0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Pool<N>, N))

Pop and clear the next link, or call make only when empty. O(1) before make.

template pool_new source · line 179 · raw

@-S:Type -> @-N:Data -> @-C:Data -> @-set_next:(@_:S -> @_:N -> @_:Maybe<&2, N> -> S) -> @-make:(@_:S -> @_:C -> Pair(S, N)) -> @+size:Nat -> @s:S -> @+c:C -> Pair(S, 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.Pool<N>)

Construct max(size, 1) nodes in a LIFO pool, using the application factory.

template new_node source · line 183 · raw

@-N:Data -> @-V:Data -> @+v:V -> 0x5c489f5d9646d7cc9aa3dd8137e9dc07/src/containers/types/intrusive_doubly_linked_list.DefaultNode<N, V>

Optional detached value wrapper. The application owns its storage and identities.