From bf7c30c0e5f4d54efb8b9c679294dbd3238d563b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 2 Dec 2024 22:37:01 +0100 Subject: Slight refactor --- 2024/01/puzzle-1.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/2024/01/puzzle-1.el b/2024/01/puzzle-1.el index cd8853e..caf359b 100644 --- a/2024/01/puzzle-1.el +++ b/2024/01/puzzle-1.el @@ -1,14 +1,13 @@ (defun solve (input-file) - (let* ((nums (with-temp-buffer - (insert-file-contents-literally input-file) - (goto-char (point-min)) - (save-excursion - (insert ?\[) - (goto-char (point-max)) - (insert ?\])) - (read (current-buffer)))) - (num-count (length nums))) - (cl-loop for i from 0 below num-count + (let ((nums (with-temp-buffer + (insert-file-contents-literally input-file) + (goto-char (point-min)) + (save-excursion + (insert ?\[) + (goto-char (point-max)) + (insert ?\])) + (read (current-buffer))))) + (cl-loop for i from 0 below (length nums) if (cl-evenp i) collect (aref nums i) into xs else -- cgit v1.2.3