Standard library · Numbers and collections

collections

Data structures: vector and map, stack, queue, deque, set, linked list, priority queue and counter.

import collections
On this page
  1. Types
  2. Functions

Vector and HashMap, which turn up in every program, are defined in this package, but you do not have to import it to use them. The rest, such as the stack and the queue, become available with import collections.

All of these are generic: you set the element type with <...>, as in collections.Stack<str>. All of them allocate, so write defer ....free() right after creating one.

Which should you pick? For an ordinary list, Vector; for "last in, first out", Stack; for "first in, first out", Queue; for adding and removing at both ends, Deque; for fast lookup by a key, HashMap; for removing duplicates, Set; and for "always give me the smallest", PriorityQueue.

Types

LinkedList

struct LinkedList<T>
A doubly linked list; adding and removing at either end is fast.
NameTypeDescription
valsVectorThe values of the nodes.
nxtVectorThe index of each node's next node.
prvVectorThe index of each node's previous node.
headintThe index of the first node.
tailintThe index of the last node.
freedintThe index of the first freed node, kept for reuse.
countint = 0The number of elements.
collections-LinkedList.salam
import collections

func main:
    mut l := collections.LinkedList {} as collections.LinkedList<str>
    defer l.free()
    l.push_back("b")
    l.push_back("c")
    l.push_front("a")
    println l.to_vector(), l.size()
    println l.front_val(), l.back_val(), l.get(1)
    println l.pop_front(), l.pop_back(), l.size(), l.is_empty()
end
Output["a", "b", "c"] 3 a c b a c 1 false

push_back

func push_back(v: T)
Adds an element at the end.

The example for this item is shown with the ones above: collections-LinkedList.salam

push_front

func push_front(v: T)
Adds an element at the front.

The example for this item is shown with the ones above: collections-LinkedList.salam

pop_front

func pop_front(): T
Removes the front element and returns it.

The example for this item is shown with the ones above: collections-LinkedList.salam

pop_back

func pop_back(): T
Removes the last element and returns it.

The example for this item is shown with the ones above: collections-LinkedList.salam

front_val

func front_val(): T
The front element.

The example for this item is shown with the ones above: collections-LinkedList.salam

back_val

func back_val(): T
The last element.

The example for this item is shown with the ones above: collections-LinkedList.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-LinkedList.salam

is_empty

func is_empty(): bool
True when it is empty.

The example for this item is shown with the ones above: collections-LinkedList.salam

get

func get(i: int): T
Element number i from the front. Reaching it means walking from the front, so for repeated access by index a vector is better.

The example for this item is shown with the ones above: collections-LinkedList.salam

to_vector

func to_vector(): Vector<T>
Returns the elements, in order, in a new vector.

The example for this item is shown with the ones above: collections-LinkedList.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-LinkedList.salam

Counter

struct Counter<K>
A counter: it counts how many times it has seen each thing, such as the words in a text.
NameTypeDescription
mHashMapA map from each thing to its count.
collections-Counter.salam
import collections
import str

func main:
    mut c := collections.Counter {} as collections.Counter<str>
    defer c.free()
    each word in str.Fields("in the name of the friend"):
        c.add(word)
    end
    c.add_n("friend", 2)
    println c.count("the"), c.count("friend"), c.count("missing"), c.distinct()
end
Output2 3 0 5

add

func add(k: K)
Adds one to the count of k.

The example for this item is shown with the ones above: collections-Counter.salam

add_n

func add_n(k: K, n: int)
Adds n to the count of k.

The example for this item is shown with the ones above: collections-Counter.salam

count

func count(k: K): int
How many times k has been seen, or zero if never.

The example for this item is shown with the ones above: collections-Counter.salam

distinct

func distinct(): int
The number of different things counted.

The example for this item is shown with the ones above: collections-Counter.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-Counter.salam

PriorityQueue

struct PriorityQueue<T>
A priority queue: the smallest element comes out each time, whatever order they went in. For scheduling work and for shortest path algorithms.
NameTypeDescription
hVectorThe elements as a binary heap.
collections-PriorityQueue.salam
import collections

func main:
    mut q := collections.PriorityQueue {} as collections.PriorityQueue<int>
    defer q.free()
    each n in [5, 1, 4, 2, 3]:
        q.push(n)
    end
    println q.peek(), q.size()
    until not q.is_empty():
        print q.pop(), ""
    end
    println ""
end
Output1 5 1 2 3 4 5

push

func push(x: T)
Adds an element.

The example for this item is shown with the ones above: collections-PriorityQueue.salam

peek

func peek(): T
Shows the smallest element without removing it.

The example for this item is shown with the ones above: collections-PriorityQueue.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-PriorityQueue.salam

is_empty

func is_empty(): bool
True when it is empty.

The example for this item is shown with the ones above: collections-PriorityQueue.salam

pop

func pop(): T
Removes the smallest element and returns it.

The example for this item is shown with the ones above: collections-PriorityQueue.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-PriorityQueue.salam

Set

struct Set<T>
A set: each element only once. For removing duplicates and asking "is this one there?" quickly.
NameTypeDescription
mHashMapThe map that holds the elements as keys.
collections-Set.salam
import collections

func main:
    mut s := collections.Set {} as collections.Set<str>
    defer s.free()
    each word in ["hello", "world", "hello"]:
        s.add(word)
    end
    println s.size(), s.has("hello"), s.has("goodbye")
    println s.remove("world"), s.size(), s.is_empty()
end
Output2 true false true 1 false

add

func add(x: T)
Adds an element; if it is already there, nothing happens.

The example for this item is shown with the ones above: collections-Set.salam

has

func has(x: T): bool
True when the element is in the set.

The example for this item is shown with the ones above: collections-Set.salam

remove

func remove(x: T): bool
Removes an element, and returns false when it was not there.

The example for this item is shown with the ones above: collections-Set.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-Set.salam

is_empty

func is_empty(): bool
True when it is empty.

The example for this item is shown with the ones above: collections-Set.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-Set.salam

OrderedMap

struct OrderedMap
A map from string to string that keeps the insertion order, for headers, settings and anywhere the display order matters.
NameTypeDescription
keysVectorThe keys in insertion order.
valsVectorThe values in the same order.
idxHashMapA map from key to its position, for fast lookup.
collections-OrderedMap.salam
import collections

func main:
    mut m := collections.OrderedMap {}
    defer m.free()
    m.set("name", "Salam")
    m.set("version", "0.5.0")
    m.set("language", "english")
    println m.len(), m.has("version"), m.get("name"), m.get_or("licence", "-")
    println m.index_of("language"), m.key_at(0), m.val_at(0)
    m.set_at(0, "Salam")
    println m.remove("version"), m.len()
    keys := m.clone_keys()
    println keys
end
Output3 true Salam - 2 name Salam 1 2 ["name", "language"]

index_of

func index_of(k: str): int
Returns the position of a key, or minus one.

The example for this item is shown with the ones above: collections-OrderedMap.salam

len

func len(): int
The number of keys.

The example for this item is shown with the ones above: collections-OrderedMap.salam

has

func has(k: str): bool
True when the key is there.

The example for this item is shown with the ones above: collections-OrderedMap.salam

get

func get(k: str): str
The value for a key, or an empty string when it is absent.

The example for this item is shown with the ones above: collections-OrderedMap.salam

get_or

func get_or(k: str, def: str): str
The value for a key, or the default.

The example for this item is shown with the ones above: collections-OrderedMap.salam

set

func set(k: str, v: str): int
Stores the value for a key; a new key goes on the end and an existing key keeps its place. It returns the key's position.

The example for this item is shown with the ones above: collections-OrderedMap.salam

key_at

func key_at(i: int): str
Key number i.

The example for this item is shown with the ones above: collections-OrderedMap.salam

val_at

func val_at(i: int): str
Value number i.

The example for this item is shown with the ones above: collections-OrderedMap.salam

set_at

func set_at(i: int, v: str)
Replaces value number i.

The example for this item is shown with the ones above: collections-OrderedMap.salam

remove

func remove(k: str): int
Removes a key and returns the position it had, or minus one.

The example for this item is shown with the ones above: collections-OrderedMap.salam

clone_keys

func clone_keys(): Vector<str>
A copy of the keys in insertion order.

The example for this item is shown with the ones above: collections-OrderedMap.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-OrderedMap.salam

Deque

struct Deque<T>
A double-ended queue: you can add and remove at either end, and both are fast.
NameTypeDescription
frontVectorThe elements at the front end.
backVectorThe elements at the back end.
collections-Deque.salam
import collections

func main:
    mut d := collections.Deque {} as collections.Deque<int>
    defer d.free()
    d.push_back(2)
    d.push_back(3)
    d.push_front(1)
    println d.front_val(), d.back_val(), d.get(1), d.size()
    println d.pop_front(), d.pop_back(), d.size(), d.is_empty()
end
Output1 3 2 3 1 3 1 false

push_front

func push_front(x: T)
Adds an element at the front.

The example for this item is shown with the ones above: collections-Deque.salam

push_back

func push_back(x: T)
Adds an element at the back.

The example for this item is shown with the ones above: collections-Deque.salam

pop_front

func pop_front(): T
Removes the front element and returns it.

The example for this item is shown with the ones above: collections-Deque.salam

pop_back

func pop_back(): T
Removes the back element and returns it.

The example for this item is shown with the ones above: collections-Deque.salam

front_val

func front_val(): T
Shows the front element without removing it.

The example for this item is shown with the ones above: collections-Deque.salam

back_val

func back_val(): T
Shows the back element without removing it.

The example for this item is shown with the ones above: collections-Deque.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-Deque.salam

is_empty

func is_empty(): bool
True when it is empty.

The example for this item is shown with the ones above: collections-Deque.salam

get

func get(i: int): T
Element number i counted from the front.

The example for this item is shown with the ones above: collections-Deque.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-Deque.salam

Vector

struct Vector<T>
A list whose size changes: the data structure you will use most. The elements sit next to each other in memory and access by index is immediate. You can also read and write elements with [i].
NameTypeDescription
dataT*The address of the elements in memory.
collections-Vector.salam
func main:
    mut v := Vector {} as Vector<int>
    defer v.free()
    v.reserve(8)
    println v.len(), v.cap() >= 8, v.is_empty()
    v.push(10)
    v.push(20)
    v.push(30)
    println v, v.first(), v.last(), v.get(1), v[2]
    v.set(0, 11)
    v[1] = 22
    v.insert(1, 15)
    println v
    println v.remove_at(1), v.pop(), v
    r := v.ref(0)
    r[0] = 99
    println v
    v.resize_set(v.len(), 7)
    println v
    v.clear()
    println v.len()
    mut z := Vector {} as Vector<int>
    defer z.free()
    z.zeros(3)
    println z
    mut a := Vector {} as Vector<int>
    defer a.free()
    a.alloc(4)
    println a.len()
end
Output0 true true [10, 20, 30] 10 30 20 30 [11, 15, 22, 30] 15 30 [11, 22] [99, 22] [99, 22, 7] 0 [0, 0, 0] 4

reserve

func reserve(need: int)
Reserves room for at least need elements in advance, so that later additions do not move the memory again.

The example for this item is shown with the ones above: collections-Vector.salam

push

func push(x: T)
Adds an element at the end.

The example for this item is shown with the ones above: collections-Vector.salam

pop

func pop(): T
Removes the last element and returns it.

The example for this item is shown with the ones above: collections-Vector.salam

get

func get(i: int): T
Returns element number i.

The example for this item is shown with the ones above: collections-Vector.salam

ref

func ref(i: int): T*
Returns the address of element number i, so you can change it in place without a copy.

The example for this item is shown with the ones above: collections-Vector.salam

set

func set(i: int, x: T)
Replaces element number i.

The example for this item is shown with the ones above: collections-Vector.salam

resize_set

func resize_set(i: int, x: T)
Like set, but grows the vector when i is past the end. The slots between the old length and i have no defined value, so either fill them in order or start with zeros.

The example for this item is shown with the ones above: collections-Vector.salam

zeros

func zeros(n: int)
Gives the vector n zero elements.

The example for this item is shown with the ones above: collections-Vector.salam

alloc

func alloc(n: int)
Sets the vector's length to n without initialising it; fill the elements before reading them.

The example for this item is shown with the ones above: collections-Vector.salam

len

func len(): int
The number of elements.

The example for this item is shown with the ones above: collections-Vector.salam

cap

func cap(): int
The current capacity: how many more elements fit before new memory is taken.

The example for this item is shown with the ones above: collections-Vector.salam

is_empty

func is_empty(): bool
True when the vector has no elements.

The example for this item is shown with the ones above: collections-Vector.salam

first

func first(): T
The first element.

The example for this item is shown with the ones above: collections-Vector.salam

last

func last(): T
The last element.

The example for this item is shown with the ones above: collections-Vector.salam

clear

func clear()
Removes every element but keeps the memory.

The example for this item is shown with the ones above: collections-Vector.salam

insert

func insert(i: int, x: T)
Inserts an element at position i and shifts the rest forward.

The example for this item is shown with the ones above: collections-Vector.salam

remove_at

func remove_at(i: int): T
Removes and returns the element at position i and shifts the rest back.

The example for this item is shown with the ones above: collections-Vector.salam

operator_index

func operator_index(i: int): T
The same as reading with v[i].

The example for this item is shown with the ones above: collections-Vector.salam

operator_index_set

func operator_index_set(i: int, x: T)
The same as writing with v[i] = x.

The example for this item is shown with the ones above: collections-Vector.salam

iter

func iter(): VectorIter<T>
Returns an iterator for walking the elements by hand. Most of the time each ... in is simpler.
collections-VectorIter.salam
func main:
    mut v := Vector {} as Vector<str>
    defer v.free()
    v.push("spring")
    v.push("summer")
    mut it := v.iter()
    until it.has_next():
        println it.value()
        it.next()
    end
end
Outputspring summer

free

func free()
Releases the vector's memory.

The example for this item is shown with the ones above: collections-Vector.salam

VectorIter

struct VectorIter<T>
A vector iterator; walk element by element with has_next, value and next.
NameTypeDescription
dataT*The address of the vector's elements.
lenint = 0The number of elements.
posint = 0The current position.

The example for this item is shown with the ones above: collections-VectorIter.salam

has_next

func has_next(): bool
True when another element is left.

The example for this item is shown with the ones above: collections-VectorIter.salam

value

func value(): T
The current element.

The example for this item is shown with the ones above: collections-VectorIter.salam

next

func next()
Moves to the next element.

The example for this item is shown with the ones above: collections-VectorIter.salam

Queue

struct Queue<T>
A queue: the first element in is the first one out, like a queue at a shop.
NameTypeDescription
inboxVectorThe newly arrived elements.
outboxVectorThe elements ready to leave; whenever it empties it is refilled from inbox.
collections-Queue.salam
import collections

func main:
    mut q := collections.Queue {} as collections.Queue<str>
    defer q.free()
    q.enqueue("customer 1")
    q.enqueue("customer 2")
    q.enqueue("customer 3")
    println q.peek(), q.size()
    println q.dequeue(), q.dequeue(), q.is_empty()
end
Outputcustomer 1 3 customer 1 customer 2 false

enqueue

func enqueue(x: T)
Adds an element at the back of the queue.

The example for this item is shown with the ones above: collections-Queue.salam

dequeue

func dequeue(): T
Takes the element at the front out.

The example for this item is shown with the ones above: collections-Queue.salam

peek

func peek(): T
Shows the element at the front without taking it out.

The example for this item is shown with the ones above: collections-Queue.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-Queue.salam

is_empty

func is_empty(): bool
True when the queue is empty.

The example for this item is shown with the ones above: collections-Queue.salam

free

func free()
Releases the queue's memory.

The example for this item is shown with the ones above: collections-Queue.salam

Stack

struct Stack<T>
A stack: the last element added is the first one taken off, like a pile of books.
NameTypeDescription
itemsVectorThe elements of the stack; the last one is the top.
collections-Stack.salam
import collections

func main:
    mut s := collections.Stack {} as collections.Stack<str>
    defer s.free()
    s.push("book 1")
    s.push("book 2")
    s.push("book 3")
    println s.peek(), s.size()
    println s.pop(), s.pop(), s.size()
    s.clear()
    println s.is_empty()
end
Outputbook 3 3 book 3 book 2 1 true

push

func push(x: T)
Puts an element on the stack.

The example for this item is shown with the ones above: collections-Stack.salam

pop

func pop(): T
Takes the top element off and returns it.

The example for this item is shown with the ones above: collections-Stack.salam

peek

func peek(): T
Shows the top element without taking it off.

The example for this item is shown with the ones above: collections-Stack.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-Stack.salam

is_empty

func is_empty(): bool
True when the stack is empty.

The example for this item is shown with the ones above: collections-Stack.salam

clear

func clear()
Takes every element off.

The example for this item is shown with the ones above: collections-Stack.salam

free

func free()
Releases the stack's memory.

The example for this item is shown with the ones above: collections-Stack.salam

Pair

struct Pair<A, B>
A pair of values, for returning two things from a function or keeping a key and a value together.
NameTypeDescription
firstAThe first value.
secondBThe second value.
collections-Pair.salam
import collections

func main:
    p := collections.Pair { first = "Tehran", second = 8700000 } as collections.Pair<str, int>
    println p.first, p.second
end
OutputTehran 8700000

CircularList

struct CircularList<T>
A circular list: after the last element you come back to the first, for taking turns in rotation, such as the players in a game.
NameTypeDescription
itemsVectorThe elements in the order they were added.
headint = 0The index of the current element.
collections-CircularList.salam
import collections

func main:
    mut c := collections.CircularList {} as collections.CircularList<str>
    defer c.free()
    each name in ["Ali", "Sara", "Reza"]:
        c.add(name)
    end
    repeat 4:
        print c.current(), ""
        c.advance()
    end
    println ""
    c.rotate(1)
    println c.to_vector(), c.get(0), c.size(), c.is_empty()
end
OutputAli Sara Reza Ali ["Reza", "Ali", "Sara"] Reza 3 false

add

func add(x: T)
Adds an element to the list.

The example for this item is shown with the ones above: collections-CircularList.salam

size

func size(): int
The number of elements.

The example for this item is shown with the ones above: collections-CircularList.salam

is_empty

func is_empty(): bool
True when it is empty.

The example for this item is shown with the ones above: collections-CircularList.salam

get

func get(i: int): T
The element i places on from the current one; a negative number is accepted.

The example for this item is shown with the ones above: collections-CircularList.salam

rotate

func rotate(k: int)
Moves the current element on by k places, or back with a negative number.

The example for this item is shown with the ones above: collections-CircularList.salam

current

func current(): T
The current element: whose turn is it?

The example for this item is shown with the ones above: collections-CircularList.salam

advance

func advance()
Passes the turn to the next element.

The example for this item is shown with the ones above: collections-CircularList.salam

to_vector

func to_vector(): Vector<T>
Returns the elements from the current one onward, in a new vector.

The example for this item is shown with the ones above: collections-CircularList.salam

free

func free()
Releases the memory.

The example for this item is shown with the ones above: collections-CircularList.salam

HashMap

struct HashMap<K, V>
A map from key to value with fast lookup, like a dictionary. The order of the entries is not predictable; if the insertion order matters, see OrderedMap.
NameTypeDescription
keysK*The address of the array of keys.
valsV*The address of the array of values.
stateint*The state of each slot: empty, filled or removed.
capint = 0The number of slots.
countint = 0The number of keys present.
usedint = 0The number of slots in use, removed ones included.
collections-HashMap.salam
func main:
    mut m := HashMap {} as HashMap<str, int>
    defer m.free()
    println m.is_empty()
    m.put("apple", 3)
    m.insert("pear", 5)
    m.put("apple", 4)
    println m.size(), m.has("apple"), m.get("apple"), m.get_or("banana", 0)
    println m.remove("pear"), m.remove("pear"), m.size()
    mut it := m.iter()
    until it.has_next():
        println it.key(), it.value()
        it.next()
    end
end
Outputtrue 2 true 4 0 true false 1 apple 4

put

func put(k: K, v: V)
Stores the value for a key, replacing an earlier value for the same key.

The example for this item is shown with the ones above: collections-HashMap.salam

insert

func insert(k: K, v: V)
The same as put.

The example for this item is shown with the ones above: collections-HashMap.salam

has

func has(k: K): bool
True when the key is in the map.

The example for this item is shown with the ones above: collections-HashMap.salam

get

func get(k: K): V
Returns the value for a key. When the key is absent you get the zero value of the type, so ask with has first or use get_or.

The example for this item is shown with the ones above: collections-HashMap.salam

get_or

func get_or(k: K, def: V): V
Returns the value for a key, or the default when it is absent.

The example for this item is shown with the ones above: collections-HashMap.salam

remove

func remove(k: K): bool
Removes a key, and returns false when it was not there.

The example for this item is shown with the ones above: collections-HashMap.salam

size

func size(): int
The number of keys.

The example for this item is shown with the ones above: collections-HashMap.salam

is_empty

func is_empty(): bool
True when the map is empty.

The example for this item is shown with the ones above: collections-HashMap.salam

iter

func iter(): MapIter<K, V>
Returns an iterator over the keys and values. Most of the time each key, value in is simpler.

The example for this item is shown with the ones above: collections-HashMap.salam

free

func free()
Releases the map's memory.

The example for this item is shown with the ones above: collections-HashMap.salam

MapIter

struct MapIter<K, V>
A map iterator.
NameTypeDescription
keysK*The address of the array of keys.
valsV*The address of the array of values.
stateint*The state of the slots.
capint = 0The number of slots.
posint = 0The current position.

The example for this item is shown with the ones above: collections-HashMap.salam

has_next

func has_next(): bool
True when another entry is left.

The example for this item is shown with the ones above: collections-HashMap.salam

key

func key(): K
The current key.

The example for this item is shown with the ones above: collections-HashMap.salam

value

func value(): V
The current value.

The example for this item is shown with the ones above: collections-HashMap.salam

next

func next()
Moves to the next entry.

The example for this item is shown with the ones above: collections-HashMap.salam

Functions

contains

func contains<T>(v: Vector<T>, x: T): bool
True when x is in the vector.
collections-Funcs.salam
import collections

func main:
    mut a := Vector {} as Vector<int>
    defer a.free()
    each n in [1, 2, 3, 2, 5]:
        a.push(n)
    end
    println collections.contains(a, 3), collections.index_of(a, 2), collections.last_index_of(a, 2), collections.count_of(a, 2)
    println collections.reverse(a), collections.slice(a, 1, 3)
    b := collections.clone(a)
    collections.swap(a, 0, 4)
    println a, b
    mut c := Vector {} as Vector<int>
    defer c.free()
    collections.extend(c, b)
    collections.extend(c, b)
    println c.len()
end
Outputtrue 1 3 2 [5, 2, 3, 2, 1] [2, 3, 2] [5, 2, 3, 2, 1] [1, 2, 3, 2, 5] 10

index_of

func index_of<T>(v: Vector<T>, x: T): int
The position of the first occurrence of x, or minus one.

The example for this item is shown with the ones above: collections-Funcs.salam

reverse

func reverse<T>(v: Vector<T>): Vector<T>
A reversed copy of the vector; the original is unchanged.

The example for this item is shown with the ones above: collections-Funcs.salam

clone

func clone<T>(v: Vector<T>): Vector<T>
An independent copy of the vector.

The example for this item is shown with the ones above: collections-Funcs.salam

slice

func slice<T>(v: Vector<T>, start: int, count: int): Vector<T>
A new vector of count elements starting at start.

The example for this item is shown with the ones above: collections-Funcs.salam

swap

func swap<T>(v: Vector<T>, i: int, j: int)
Exchanges two elements.

The example for this item is shown with the ones above: collections-Funcs.salam

count_of

func count_of<T>(v: Vector<T>, x: T): int
How many times x occurs in the vector.

The example for this item is shown with the ones above: collections-Funcs.salam

last_index_of

func last_index_of<T>(v: Vector<T>, x: T): int
The position of the last occurrence of x, or minus one.

The example for this item is shown with the ones above: collections-Funcs.salam

extend

func extend<T>(dst &: Vector<T>, src: Vector<T>)
Adds every element of src to the end of dst.

The example for this item is shown with the ones above: collections-Funcs.salam