Documentation ¶
Overview ¶
Package vector implements an immutable persistent vector.
An immutable persistent vector has copy-on-write behaviour: Each “modification” of the vector (insertion, replacement or deletion) creates a copy, leaving the original unmodified. Under the hood, copy-on-write retains most of the memory held by the original, and creates a new incarnation of parts of the structure only. Thus, most of the structure/memory is shared between original and copy, transparently to clients.
Immutable vectors are inherently concurrency-safe.
Status ¶
Awaiting Go 1.18 with generics.
License ¶
Governed by a 3-Clause BSD license. License file may be found in the root folder of this module.
Copyright © 2022 Norbert Pillmayer <norbert@pillmayer.com>
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option is a type to help initializing vectors at creation time.
func DegreeExponent ¶
DegreeExponent is an option to indirectyl set the degree of the underlying tree for a vector. The degree of the tree will be 2^exp. Accepted exponents are [1…5]; default is 3, i.e. a degree of 8.
Use it like this:
vec := vector.Immutable[int](DegreeExponent(5))