src/parazoa

    Dark Mode
Search:
Group by:

Types

IndexError = object of CatchableError
KeyError = object of CatchableError
Map[K; V] = object
  root: MapNode[K, V]
  size: Natural
MapNode[K; V] = ref object
  case kind: NodeKind
  of Branch:
      nodes: array[branchWidth, MapNode[K, V]]

  of Leaf:
      keyHash: Hash
      key: K
      value: V

  
Set[T] = object
  root: SetNode[T]
  size: Natural
SetNode[T] = ref object
  case kind: NodeKind
  of Branch:
      nodes: array[branchWidth, SetNode[T]]

  of Leaf:
      keyHash: Hash
      key: T

  
Vec[T] = object
  root: VecNode[T]
  shift: int
  size: Natural
VecNode[T] = ref object
  case kind: NodeKind
  of Branch:
      nodes: array[branchWidth, VecNode[T]]

  of Leaf:
      value: T

  

Procs

func `$`[K, V](m: Map[K, V]): string
Returns a string representing the Map
func `$`[T](s: Set[T]): string
Returns a string representing the Set
func `$`[T](v: Vec[T]): string
Returns a string representing the Vec
func `&`[K, V](m1: Map[K, V]; m2: Map[K, V]): Map[K, V]
Returns a merge of the Maps
func `&`[T](s1: Set[T]; s2: Set[T]): Set[T]
Returns a union of the Sets
func `&`[T](v1: Vec[T]; v2: Vec[T]): Vec[T]
Returns a concatenation of the Vecs
func `==`[K, V](m1: Map[K, V]; m2: Map[K, V]): bool
Returns whether the Maps are equal
func `==`[T](s1: Set[T]; s2: Set[T]): bool
Returns whether the Sets are equal
func `==`[T](v1: Vec[T]; v2: Vec[T]): bool
Returns whether the Vecs are equal
func add[K, V](m1: var Map[K, V]; m2: Map[K, V])
Merges the second Map into the first one (This sets the var to a new Map -- the old Map is not mutated)
func add[K, V](m: Map[K, V]; key: K; value: V): Map[K, V]
Adds a new key-value pair to the Map
func add[T](s1: var Set[T]; s2: Set[T])
Unites the second Set into the first one (This sets the var to a new Set -- the old Set is not mutated)
func add[T](v1: var Vec[T]; v2: Vec[T])
Concatenates the second Vec into the first one (This sets the var to a new Vec -- the old Vec is not mutated)
func add[T](v: Vec[T]; key: Natural; value: T): Vec[T]
Updates the existing value at key
func add[T](v: Vec[T]; value: T): Vec[T]
Adds a new value to the Vec
func contains[K, V](m: Map[K, V]; key: K): bool
Returns whether key is inside the Map
func contains[T](s: Set[T]; key: T): bool
Returns whether key is inside the Set
func del[K, V](m: Map[K, V]; key: K): Map[K, V]
Deletes the key-value pair at key from the Map
func excl[T](s: Set[T]; key: T): Set[T]
Deletes the key from the Set
func get[K, V](m: Map[K, V]; key: K): V
Returns the value at key, or raises an exception if not found
func get[T](v: Vec[T]; key: Natural): T
Returns the value at key, or raises an exception if out of bounds
func getOrDefault[K, V](m: Map[K, V]; key: K; defaultValue: V): V
Returns the value at key, or defaultValue if not found
func getOrDefault[T](v: Vec[T]; key: Natural; defaultValue: T): T
Returns the value at key, or defaultValue if not found
func hash[K, V](m: Map[K, V]): Hash
Returns a Hash of the Map
func hash[T](s: Set[T]): Hash
Returns a Hash of the Set
func hash[T](v: Vec[T]): Hash
Returns a Hash of the Vec
func incl[T](s: Set[T]; key: T): Set[T]
Adds a new value to the Set
func initMap[K, V](): Map[K, V]
Returns a new Map
func initSet[T](): Set[T]
Returns a new Set
func initVec[T](): Vec[T]
Returns a new Vec
func len[K, V](m: Map[K, V]): Natural
Returns the number of key-value pairs in the Map
func len[T](s: Set[T]): Natural
Returns the number of values in the Set
func len[T](v: Vec[T]): Natural
Returns the number of values in the Vec
func setLen[T](v: Vec[T]; newLen: Natural): Vec[T]
Updates the length of Vec
func toMap[K, V](arr: openArray[(K, V)]): Map[K, V]
Returns a Map containing the key-value pairs in arr
func toSet[T](arr: openArray[T]): Set[T]
Returns a Set containing the values in arr
func toVec[T](arr: openArray[T]): Vec[T]
Returns a Vec containing the values in arr

Iterators

iterator items[T](s: Set[T]): T
Iterates over the values in the Set
iterator items[T](v: Vec[T]): T
Iterates over the values in the Vec
iterator keys[K, V](m: Map[K, V]): K
Iterates over the keys in the Map
iterator pairs[K, V](m: Map[K, V]): (K, V)
Iterates over the key-value pairs in the Map
iterator pairs[T](v: Vec[T]): (Natural, T)
Iterates over the indexes and values in the Vec
iterator values[K, V](m: Map[K, V]): V
Iterates over the values in the Map