aboutsummaryrefslogtreecommitdiff
path: root/2024/aoc-utils.scm
diff options
context:
space:
mode:
authorMatias Linares <matias.linares@comprandoengrupo.net>2024-12-02 10:18:15 -0300
committerMatias Linares <matias.linares@comprandoengrupo.net>2024-12-02 10:18:15 -0300
commit2e633775d14eaa246af901b0d64542192f3c2810 (patch)
tree05a3413064f5b39b29eb81a372890b913f28ed87 /2024/aoc-utils.scm
parente309f81f40a2d01513060f7bd07daaeb5ae78ad6 (diff)
downloadadvent-of-code-2e633775d14eaa246af901b0d64542192f3c2810.tar.gz
Add part2 of day2 2024
Diffstat (limited to '2024/aoc-utils.scm')
-rw-r--r--2024/aoc-utils.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/2024/aoc-utils.scm b/2024/aoc-utils.scm
index 7fafcc6..98e83cd 100644
--- a/2024/aoc-utils.scm
+++ b/2024/aoc-utils.scm
@@ -15,3 +15,15 @@
(map (lambda (line)
(map string->number (string-split line #\Space)))
lines))
+
+(define (remove-nth l n)
+ "Remove the `N' element from `L', returning a new list."
+ (append (list-head l n) (list-tail l (1+ n))))
+
+(define (indexes lst)
+ "Get the indexes for `lst'."
+ (let ((retval '()))
+ (do ((i (1- (length lst)) (1- i)))
+ ((< i 0))
+ (set! retval (cons i retval)))
+ retval))