[p2] helper function

master
Jacopo De Simoi 6 months ago
parent 3301862db1
commit 009e4d5227
  1. 28
      p2/p2.org

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

Loading…
Cancel
Save