aboutsummaryrefslogtreecommitdiff
path: root/2024/aoc-utils.scm
diff options
context:
space:
mode:
Diffstat (limited to '2024/aoc-utils.scm')
-rw-r--r--2024/aoc-utils.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/2024/aoc-utils.scm b/2024/aoc-utils.scm
index 5deb269..ed16bfd 100644
--- a/2024/aoc-utils.scm
+++ b/2024/aoc-utils.scm
@@ -5,6 +5,7 @@
#:use-module (ice-9 rdelim)
#:export (file->list
file->str
+ file->matrix
lines->number-list))
(define (file->list filename)
@@ -15,6 +16,9 @@
(define (file->str filename)
(call-with-input-file filename read-string))
+(define (file->matrix filename)
+ (map string->list (file->list filename)))
+
(define (lines->number-list lines)
(map (lambda (line)
(map string->number (string-split line #\Space)))