2020-12-03 09:54:58 -06:00
|
|
|
import streams, strutils, sugar
|
|
|
|
|
|
|
|
iterator mapStream*[T](s: Stream, cb: (string) -> T): T =
|
2020-12-03 11:42:18 -06:00
|
|
|
for line in s.lines(): yield cb line
|
2020-12-03 09:54:58 -06:00
|
|
|
|
|
|
|
iterator asInts*(s: Stream): int =
|
2020-12-03 11:42:18 -06:00
|
|
|
for i in mapStream[int](s, parseInt): yield i
|