This commit is contained in:
Araq 2014-11-15 11:10:13 +01:00
commit f7dca91344
8 changed files with 31 additions and 10 deletions

View file

@ -302,6 +302,10 @@ template toSeq*(iter: expr): expr {.immediate.} =
## result = true)
## assert odd_numbers == @[1, 3, 5, 7, 9]
##
## **Note**: Since this is an immediate macro, you cannot always invoke this
## as ``x.toSeq``, depending on the ``x``.
## See `this <manual.html#limitations-of-the-method-call-syntax>`_
## for an explanation.
var result {.gensym.}: seq[type(iter)] = @[]
for x in iter: add(result, x)
result

View file

@ -8,7 +8,7 @@
#
## Floating-point environment. Handling of floating-point rounding and
## exceptions (overflow, zero-devide, etc.).
## exceptions (overflow, division by zero, etc.).
{.deadCodeElim:on.}

View file

@ -904,9 +904,8 @@ proc `of` *[T, S](x: T, y: S): bool {.magic: "Of", noSideEffect.}
## Checks if `x` has a type of `y`
##
## .. code-block:: Nim
## assert(EFloatingPoint of EBase)
## assert(EIO of ESystem)
## assert(EDivByZero of EBase)
## assert(FloatingPointError of Exception)
## assert(DivByZeroError of Exception)
proc cmp*[T](x, y: T): int {.procvar.} =
## Generic compare proc. Returns a value < 0 iff x < y, a value > 0 iff x > y