Skip to content

Instantly share code, notes, and snippets.

@flaviut
Forked from anonymous/test.nim
Created March 11, 2014 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flaviut/9478636 to your computer and use it in GitHub Desktop.
Save flaviut/9478636 to your computer and use it in GitHub Desktop.
proc next[R](input: iterator(): R): R =
for v in input:
return v
iterator t: int {.closure.} =
yield 1
t.next
# test.nim(2, 13) Error: type mismatch: got (iterator (): int{.closure.})
# but expected one of:
# system.items(E: typedesc[enum]): iter[typedesc[enum]]
# system.items(a: set[T]): iter[T]
# system.items(a: cstring): iter[char]
# system.items(a: string): iter[char]
# system.items(a: array[IX, T]): iter[T]
# system.items(a: seq[T]): iter[T]
# system.items(a: openarray[T]): iter[T]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment