ptk/private/util.nim
2018-10-02 09:19:59 -05:00

9 lines
194 B
Nim

template first*(a: openarray): auto = a[0]
template last*(a: openarray): auto = a[len(a)-1]
proc flatten*[T](a: seq[seq[T]]): seq[T] =
result = @[]
for subseq in a:
result.add(subseq)