diff options
Diffstat (limited to '2024')
-rw-r--r-- | 2024/01/puzzle-1.el | 19 |
1 files 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 |