From afd5fe3c8748b6e5c58b201668e40ee66f0a3c77 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 3 Dec 2024 12:46:36 +0100 Subject: Simplify solution --- 2024/01/puzzle-1.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '2024') diff --git a/2024/01/puzzle-1.el b/2024/01/puzzle-1.el index caf359b..622e9e5 100644 --- a/2024/01/puzzle-1.el +++ b/2024/01/puzzle-1.el @@ -8,10 +8,11 @@ (insert ?\])) (read (current-buffer))))) (cl-loop for i from 0 below (length nums) + for x = (aref nums i) if (cl-evenp i) - collect (aref nums i) into xs + collect x into xs else - collect (aref nums i) into ys + collect x into ys finally return (thread-last (seq-mapn #'- (sort xs) (sort ys)) (mapcar #'abs) -- cgit v1.2.3