aboutsummaryrefslogtreecommitdiff
path: root/2024/aoc-utils.scm
diff options
context:
space:
mode:
authorMatias Linares <matias@deprecated.org>2024-12-01 21:54:12 -0300
committerMatias Linares <matias@deprecated.org>2024-12-01 21:54:12 -0300
commitf9f11695270872f7cf8c6616274bb2ef340575ec (patch)
tree570f8f97dfa8d463d3da9289c7cd7ddcafb6580e /2024/aoc-utils.scm
parenta73cbbc18cb365cfcb069cb712f55dc30325c974 (diff)
downloadadvent-of-code-f9f11695270872f7cf8c6616274bb2ef340575ec.tar.gz
Add 2024
Diffstat (limited to '2024/aoc-utils.scm')
-rw-r--r--2024/aoc-utils.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/2024/aoc-utils.scm b/2024/aoc-utils.scm
new file mode 100644
index 0000000..6b57aa5
--- /dev/null
+++ b/2024/aoc-utils.scm
@@ -0,0 +1,11 @@
+(define-module (aoc-utils)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 rdelim)
+ #:export (file->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)))))