ptk/private/util.nim
2018-10-03 04:01:29 -05:00

12 lines
272 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)
proc raiseEx*(reason: string): void = raise newException(Exception, reason)