src/pylib/builtins/iters

Source   Edit  

Some iterable in builtins

XXX: For JS backend: Currently due to Nim's inner buys, using of some iterable functions in this modules may result in Error: ...:

  • list(...)
  • filter/map/... as func (using iterator is okey) (solved after Nim-2.1.1)

For details, trace:

Procs

func enumerate[T](x: Iterable[T]; start = 0): Enumerate[T]
Source   Edit  
func filter[T](comp: NoneType; iter: Iterable[T]): Filter[T]
Source   Edit  
func filter[T](comp: proc (arg: T): bool; iter: Iterable[T]): Filter[T]
Source   Edit  
func map[T, R](function: proc (x: T): R; iterable: Iterable[T]): Map[T]
Source   Edit  
func reversed[T](x: Sequence[T]): Reversed[T]
Source   Edit  
func zip[A, B](it1: Iterable[A]; it2: Iterable[B]; strict = false): Zip[A]
Source   Edit  

Iterators

iterator enumerate[T](x: Iterable[T]; start = 0): (int, T)
Source   Edit  
iterator filter[T](comp: NoneType; iter: Iterable[T]): T
Source   Edit  
iterator filter[T](comp: proc (arg: T): bool; iter: Iterable[T]): T
Source   Edit  
iterator items[T](x: Enumerate[T]): T
Source   Edit  
iterator items[T](x: Filter[T]): T
Source   Edit  
iterator items[T](x: Map[T]): T
Source   Edit  
iterator items[T](x: Reversed[T]): T
Source   Edit  
iterator items[T](x: Zip[T]): T
Source   Edit  
iterator map[T, R](function: proc (x: T): R; iterable: Iterable[T]): R
Source   Edit  
iterator reversed[T](x: Sequence[T]): T
Source   Edit  
iterator zip[A, B](it1: Iterable[A]; it2: Iterable[B]; strict = false): (A, B)
Source   Edit  

Macros

macro zip(iterables_or_strict: varargs[untyped]): Zip
zip(*args, strict=False)

To support its similarity with Python's zip function signature, this macro signature has to be varargs[untyped].

So it's designed to be undefined when pylibDisableMoreArgsZip is defined.

Source   Edit