21 lines
534 B
Nim
21 lines
534 B
Nim
import streams, strutils
|
|
|
|
|
|
func getFileName(daynum: int, suffix: string = ""): string =
|
|
if daynum < 10:
|
|
result = "0"
|
|
result = "data/" & result & $daynum & suffix & ".txt"
|
|
|
|
|
|
proc loadStrings*(daynum: int, suffix: string = ""): seq[string] =
|
|
var s = openFileStream(getFileName(daynum, suffix))
|
|
for line in s.lines():
|
|
result.add(line)
|
|
|
|
|
|
proc loadInts*(daynum: int): seq[int] =
|
|
var s = openFileStream(getFileName(daynum))
|
|
for line in s.lines():
|
|
let n = parseInt(line)
|
|
result.add(n)
|