parent
43c9d64318
commit
9d30ab98bf
1 changed files with 22 additions and 0 deletions
@ -0,0 +1,22 @@ |
||||
#+title: A collection of helper functions for Advent of Code |
||||
* inout manipulation |
||||
#+begin_src emacs-lisp :results none |
||||
(require 'dash) |
||||
(defun advent/replace-multiple-regex-buffer (regex-list) |
||||
"Takes REGEX-LIST as an alist ( regex . replacement ) |
||||
and applies each substitiution |
||||
" |
||||
(insert-file-contents "input") |
||||
(goto-char (point-min)) |
||||
(replace-regexp "\\([0-9]+\\),\\([0-9]+\\)" "(\\1 \\2)") |
||||
(goto-char (point-min)) |
||||
(insert "(setq data '(") |
||||
(goto-char (point-max)) |
||||
(insert "))") |
||||
(eval-buffer)) |
||||
(setq width 71 ;71 |
||||
height 71 |
||||
start-pos '(0 0) |
||||
end-pos (list (- width 1) (- height 1))) |
||||
(setq full-data data) |
||||
#+end_src |
||||
Loading…
Reference in new issue