Data and Math

vcollections

Deques, counters, ordered maps and named records, the containers programs reach for.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/collections.ven"
vcollections.ven
d = deque_new()
deque_push_back(d, 1)
deque_push_front(d, 0)
print deque_length(d)
Reference (24 functions)

API reference

deque_new()

Creates a new, empty Deque.

deque_new()

deque_push_back(d, x)

Appends x to the back of d, in place.

d = deque_new()
deque_push_back(d, 1)

deque_push_front(d, x)

Inserts x at the front of d, in place.

d = deque_new()
deque_push_front(d, 0)

deque_pop_back(d)

Removes and gives back the value at the back of d.

d = deque_new()
deque_push_back(d, 1)
deque_pop_back(d)

deque_pop_front(d)

Removes and gives back the value at the front of d.

d = deque_new()
deque_push_back(d, 1)
deque_pop_front(d)

deque_peek_back(d)

Gives back the value at the back of d without removing it.

d = deque_new()
deque_push_back(d, 1)
deque_peek_back(d)

deque_peek_front(d)

Gives back the value at the front of d without removing it.

d = deque_new()
deque_push_back(d, 1)
deque_peek_front(d)

deque_length(d)

Gives back how many elements d currently holds.

d = deque_new()
deque_length(d)

deque_is_empty(d)

Tests whether d currently holds no elements.

d = deque_new()
deque_is_empty(d)

deque_to_list(d)

Gives back ds elements as a plain List, front to back.

d = deque_new()
deque_push_back(d, 1)
deque_to_list(d)

Counter: value to occurrence count

counter_from(items)

Builds a value-to-occurrence-count Map from items.

counter_from(["a", "b", "a", "c", "a", "b"])

counter_most_common(counter, n)

Gives back the n most frequent (value, count) pairs in counter, highest count first.

c = counter_from(["a", "b", "a", "c", "a", "b"])
counter_most_common(c, 2)

counter_total(counter)

Gives back the sum of every occurrence count in counter.

c = counter_from(["a", "b", "a", "c", "a", "b"])
counter_total(c)

ordered_map_new()

Creates a new, empty insertion-ordered Map.

ordered_map_new()

named_tuple_new(field_names, values)

Builds a Map pairing each name in field_names with the value at the same position in values.

named_tuple_new(["x", "y"], [3, 4])

chunked_deque_new()

A new, empty ChunkedDeque.

chunked_deque_to_list(cd)

cd's elements as a plain List, front to back.

chunked_deque_from_list(items)

Builds a ChunkedDeque from every element of items, in order.

Get notified when vcollections changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.