|
|
|
|
@ -3,15 +3,21 @@ |
|
|
|
|
First load the data as a list of cons cells (stsrt . end) |
|
|
|
|
#+begin_src emacs-lisp :results none |
|
|
|
|
(with-temp-buffer |
|
|
|
|
(insert-file-contents "input-test") |
|
|
|
|
(advent/replace-multiple-regex-buffer |
|
|
|
|
'(("," . "\n") |
|
|
|
|
("-" . " . ") |
|
|
|
|
("^" . "(") |
|
|
|
|
("$" . ")"))) |
|
|
|
|
(goto-char (point-min)) |
|
|
|
|
(insert "(setq data '(") |
|
|
|
|
(goto-char (point-max)) |
|
|
|
|
(insert "))") |
|
|
|
|
(eval-buffer)) |
|
|
|
|
(insert-file-contents "input-test") |
|
|
|
|
(advent/replace-multiple-regex-buffer |
|
|
|
|
'(("," . "\n") |
|
|
|
|
("-" . " . ") |
|
|
|
|
("^" . "(") |
|
|
|
|
("$" . ")"))) |
|
|
|
|
(goto-char (point-min)) |
|
|
|
|
(insert "(setq data '(") |
|
|
|
|
(goto-char (point-max)) |
|
|
|
|
(insert "))") |
|
|
|
|
(eval-buffer)) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
#+begin_src emacs-lisp :results none |
|
|
|
|
(defun create-range (rng) |
|
|
|
|
(-iterate #'1+ (car rng) (1+ (- (cdr rng) (car rng))))) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
|