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 98e83cd..5deb269 100644
--- a/2024/aoc-utils.scm
+++ b/2024/aoc-utils.scm
@@ -4,6 +4,7 @@
#:use-module (ice-9 regex)
#:use-module (ice-9 rdelim)
#:export (file->list
+ file->str
lines->number-list))
(define (file->list filename)
@@ -11,6 +12,9 @@
; Remove EOF token
(take lines (1- (length lines)))))
+(define (file->str filename)
+ (call-with-input-file filename read-string))
+
(define (lines->number-list lines)
(map (lambda (line)
(map string->number (string-split line #\Space)))