diff options
Diffstat (limited to '2024/aoc-utils.scm')
-rw-r--r-- | 2024/aoc-utils.scm | 11 |
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))))) |