diff options
author | Matias Linares <matias@deprecated.org> | 2024-12-10 08:56:26 -0300 |
---|---|---|
committer | Matias Linares <matias@deprecated.org> | 2024-12-10 08:56:32 -0300 |
commit | 28d6d95fcbe14494857d80da7ea02b5926d85a15 (patch) | |
tree | 714e8d3339f11fc283be2f31cdcdfb89deeecd8f /2024/aoc-utils.scm | |
parent | 1a81d370510a01b482aae8033704d1a0523d11b7 (diff) | |
download | advent-of-code-28d6d95fcbe14494857d80da7ea02b5926d85a15.tar.gz |
Diffstat (limited to '2024/aoc-utils.scm')
-rw-r--r-- | 2024/aoc-utils.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/2024/aoc-utils.scm b/2024/aoc-utils.scm index 9f22c47..99e086a 100644 --- a/2024/aoc-utils.scm +++ b/2024/aoc-utils.scm @@ -8,6 +8,7 @@ file->str file->matrix lines->number-list + element-index <matrix> matrix @@ -49,6 +50,10 @@ (set! retval (cons i retval))) retval)) +(define (element-index e lst) + (cond [(eqv? e (car lst)) 0] + [else (+ (element-index e (cdr lst)) 1)])) + ;; Matrix utilities (define-record-type <matrix> |