advent-of-code/2020/src/input_helpers.nim

10 lines
222 B
Nim
Raw Normal View History

2020-12-03 09:54:58 -06:00
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