8 lines
214 B
Nim
8 lines
214 B
Nim
import streams, strutils, sugar
|
|
|
|
iterator mapStream*[T](s: Stream, cb: (string) -> T): T =
|
|
for line in s.lines(): yield cb line
|
|
|
|
iterator asInts*(s: Stream): int =
|
|
for i in mapStream[int](s, parseInt): yield i
|