aboutsummaryrefslogtreecommitdiff
path: root/2024/01
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-12-03 12:46:36 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-12-03 12:46:36 +0100
commitafd5fe3c8748b6e5c58b201668e40ee66f0a3c77 (patch)
tree3cb3b045327886274abf93c8a5d0feea6b1ce364 /2024/01
parent2586844a875720703e614138297f10e45ce94735 (diff)
Simplify solution
Diffstat (limited to '2024/01')
-rw-r--r--2024/01/puzzle-1.el5
1 files changed, 3 insertions, 2 deletions
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)