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