src/pylib/collections_abc

Source   Edit  

Types

Collection[T] = Sized and Container[T] and Iterable[T]
Source   Edit  
Container[T] = concept self
    T
    contains(self, T) is bool
Source   Edit  
Iterable[T] = concept self
    T
    when SupportIteratorHit:
      iterator items(self): T
    else:
      when defined(js):
        typeof(self.items(), ItemTypeMode) is T
      else:
        for value in self:
          value is T
Mimic Pythons Iterable. But not checks iter Source   Edit  
Iterator[T] = concept selfof Iterable[T]
    T
    self.next is T
Source   Edit  
Mapping[K; V] = concept selfof Collection[K]
    K
    V
    self[K] is V
Source   Edit  
MutableSequence[T] = concept selfof Sequence[T]
    T
    self[int] = T
    self.delitem(int)
    self.insert(int, T)      ## insert item before index
__delitem__ Source   Edit  
Sequence[T] = concept selfof Collection[T]
    T
    self[int] is T
Source   Edit  
Sized = concept self
    len(self) is int
Source   Edit  

Procs

func `==`[K, V](a, b: Mapping[K, V]): bool
Source   Edit  
func append[T](ms: MutableSequence[T]; x: T)
Source   Edit  
func clear(ms: MutableSequence)
Source   Edit  
func contains[K, V](m: Mapping[K, V]; k: K): bool
Source   Edit  
func contains[T](s: Container[T]; x: T): bool
Source   Edit  
func count[T](s: Sequence[T]; x: T): int
Source   Edit  
func extend[T](ms: MutableSequence[T]; it: Iterable[T])
Source   Edit  
func get[K, V](m: Mapping[K, V]; key: K): V
Source   Edit  
func get[K, V](m: Mapping[K, V]; key: K; default: V): V
Source   Edit  
func index[T](s: Sequence[T]; x: T; start = 0; stop = -1): int
Source   Edit  
func pop[T](ms: MutableSequence[T]; index = -1): T
Source   Edit  
func remove[T](ms: MutableSequence[T]; x: T)
Source   Edit  
func reverse(ms: MutableSequence)
Source   Edit  

Iterators

iterator items[K, V](m: Mapping[K, V]): (K, V)
Source   Edit  
iterator values[K, V](m: Mapping[K, V]): V
Source   Edit  

Templates

template keys[K, V](m: Mapping[K, V]): untyped
Source   Edit