From 28d6d95fcbe14494857d80da7ea02b5926d85a15 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Tue, 10 Dec 2024 08:56:26 -0300 Subject: Add day 05 - 2024 --- 2024/aoc-utils.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to '2024/aoc-utils.scm') 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 @@ -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 -- cgit v1.2.3-70-g09d2