ptk/private/ptkutil.nim
2017-02-09 10:57:51 -06: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)