diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-12-02 22:37:01 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-12-02 22:37:01 +0100 |
commit | bf7c30c0e5f4d54efb8b9c679294dbd3238d563b (patch) | |
tree | 79b9cebe8e5530bd6f49c2d367063c8cd1b5889f /2024 | |
parent | 225cbc55a4992e3b656129fe75e51a139bee2d07 (diff) |
Slight refactor
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 |