Skip to content

Instantly share code, notes, and snippets.

@narimiran
Created March 22, 2018 18:12
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 narimiran/1af51ba1cecab11b8f3a27fdcc9d0eed to your computer and use it in GitHub Desktop.
Save narimiran/1af51ba1cecab11b8f3a27fdcc9d0eed to your computer and use it in GitHub Desktop.
proc chain[T](xs: varargs[seq[T]]): iterator: T =
iterator inner: T =
for x in xs.items:
for i in 0 ..< x.len:
yield x[i]
inner
let ch1 = chain(@[1, 2, 3, 4], @[5, 4, 3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment