# Module sequtils

Author: | Alex Mitchell

This module implements operations for the built-in seq type which were inspired by functional programming languages.

Note: This interface will change as soon as the compiler supports closures and proper coroutines.

# Procs

    proc concat*[T](seqs: varargs[seq[T]]): seq[T]

  Takes several sequences' items and returns them inside of one sequence.

    proc distnct*[T](seq1: seq[T]): seq[T]

  Removes duplicates from a sequence and returns it.

    proc zip*[S, T](seq1: seq[S]; seq2: seq[T]): seq[tuple[a: S, b: T]]

  Combines two sequences. If one sequence is too short, the remaining items in the longer sequence are discarded.

    proc filter*[T](seq1: seq[T]; pred: proc (item: T): bool {.closure.}): seq[T]

  Returns all items in a sequence that fulfilled the predicate.

# Iterators

    iterator filter*[T](seq1: seq[T]; pred: proc (item: T): bool {.closure.}): T

  Iterates through a sequence and yields every item that fulfills the predicate.

# Templates

    template filterIt*(seq1, pred: expr): expr {.immediate, dirty.}

  Finds a specific item in a sequence as long as the predicate returns true. The predicate needs to be an expression containing `it`: `filterIt("abcxyz", it == 'x')`.

Generated: 2012-09-23 21:47:54 UTC