diff options
author | Matias Linares <matias@deprecated.org> | 2024-12-02 08:53:23 -0300 |
---|---|---|
committer | Matias Linares <matias@deprecated.org> | 2024-12-02 08:53:23 -0300 |
commit | e309f81f40a2d01513060f7bd07daaeb5ae78ad6 (patch) | |
tree | a54dab57a93c1d29467e7f100ddc874ee7e85e97 /2024/aoc-utils.scm | |
parent | f9f11695270872f7cf8c6616274bb2ef340575ec (diff) | |
download | advent-of-code-e309f81f40a2d01513060f7bd07daaeb5ae78ad6.tar.gz |
Add 2 day of 2024 (part1)
Diffstat (limited to '2024/aoc-utils.scm')
-rw-r--r-- | 2024/aoc-utils.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/2024/aoc-utils.scm b/2024/aoc-utils.scm index 6b57aa5..7fafcc6 100644 --- a/2024/aoc-utils.scm +++ b/2024/aoc-utils.scm @@ -3,9 +3,15 @@ #:use-module (srfi srfi-9) #:use-module (ice-9 regex) #:use-module (ice-9 rdelim) - #:export (file->list)) + #:export (file->list + lines->number-list)) (define (file->list filename) (let ((lines (string-split (call-with-input-file filename read-string) #\Newline))) ; Remove EOF token (take lines (1- (length lines))))) + +(define (lines->number-list lines) + (map (lambda (line) + (map string->number (string-split line #\Space))) + lines)) |