docs / vector

vector

Types

Diff

DiffAdd

DiffMove

DiffRemove

DiffUpdate

Vector

Functions

concat

fn(left: Vector<'a>, right: Vector<'a>) -> Vector<'a>

Adds the items in right to the end of the items in left and returns a new Vector.

diff

fn(old: Vector<'a>, new_vec: Vector<'a>, key: fn ('a) -> 'k / 't6891) -> Diff<'k, 'a> / { 't6891 }

filter

fn(vec: Vector<'a>, predicate: fn ('a) -> Bool / 't5336) -> Vector<'a> / { 't5336, ..'t5336 }

fold_left

fn(vec: Vector<'a>, init: 'b, f: fn ('b, 'a) -> 'b / { 't5439, 't5427, 't5457, 't5427, ..'t5457 }) -> 'b / { 't5439, 't5427, 't5457, 't5427, ..'t5457 }

from_array

fn(a: Array<'a>) -> Vector<'a>

get

fn(vec: Vector<'a>, index: Int) -> Option<'a>

Returns the item at the given index, or None if the index is out of bounds.

index_of

fn(vec: Vector<'a>, predicate: fn ('a) -> Bool / 't5569) -> Option<Int> / { 't5569, 't5569, 't5618, ..'t5618 }

Returns the index of the first item matching predicate, or None.

initialize

fn(length: Int, item_fn: fn (Int) -> 'a / 't1706) -> Vector<'a> / { 't1706, ..'t1706 }

Creates a new Vector of the given length, with the item at each index generated by the provided function.

insert_at

fn(vec: Vector<'a>, index: Int, item: 'a) -> Vector<'a>

Inserts item at index, shifting subsequent elements right.

length

fn(vec: Vector<'a>) -> Int

map

fn(vec: Vector<'a>, map_fn: fn ('a) -> 'b) -> Vector<'b>

map_with_accumulator

fn(vec: Vector<'a>, acc: 'acc, f: fn ('acc, 'a) -> ('acc, 'b) / 't2058) -> (Vector<'b>, 'acc) / { 't2058, ..'t2058 }

new

'a . fn () -> Vector<'a>

Creates a new, empty Vector.

pop

fn(vec: Vector<'a>) -> (Option<'a>, Vector<'a>)

push

fn(vec: Vector<'a>, item: 'a) -> Vector<'a>

Adds an item to the end of the vector.

remove

fn(vec: Vector<'a>, index: Int) -> Vector<'a>

set

fn(vec: Vector<'a>, index: Int, value: 'a) -> Vector<'a>

slice

fn(vec: Vector<'a>, start: Int, end: Int) -> Vector<'a>

swap

fn(vec: Vector<'a>, i: Int, j: Int) -> Vector<'a>

update

fn(vec: Vector<'a>, index: Int, f: fn ('a) -> 'a / 't4142) -> Vector<'a> / { 't4142, ..'t4221 }

update_items

fn(vec: Vector<'t>, items: Array<(Int, 't)>) -> Vector<'t>

Applies a batch of updates to specific indices in a single tree walk. items is an array of (index, new_value) sorted in ascending order by index. Only touches tree nodes that contain updated indices; unchanged nodes preserve identity.

update_where

fn(vec: Vector<'t>, f: fn ('t, Int) -> Option<'t> / 't2239) -> Vector<'t> / { 't2239, ..'t2239 }

Conditionally updates items in a vector. For each item, f receives the item and its index. Return None to keep the original, Some(new) to replace it. Preserves node identity for unchanged subtrees.

Handlers

impl_append

't4130 , 't4129 , 't4136 . fn ('t4130 / 't4129) -> 't4130 / { 't4129, -{unknown}<Vector<'t4136>> }

Handler that provides ++ (Append) for vectors via concat.