2022-12-04 23:00:21 -06:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;; Copyright (C) 2022
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(defun aoc-read-file (file)
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents-literally file nil)
|
|
|
|
(decode-coding-string (buffer-substring-no-properties (point-min) (point-max)) 'utf-8)))
|
|
|
|
|
|
|
|
(defun aoc-read-file-lines (file &optional omit-nulls)
|
|
|
|
(string-lines (aoc-read-file file) omit-nulls))
|
|
|
|
|
|
|
|
(defmacro aoc-debug (expr)
|
|
|
|
`(let ((e ,expr))
|
2022-12-05 23:31:12 -06:00
|
|
|
(princ (format "%s\n\n" e) 'external-debugging-output)
|
|
|
|
(unless noninteractive
|
|
|
|
(debug e))
|
2022-12-04 23:00:21 -06:00
|
|
|
e))
|
|
|
|
|
2022-12-05 23:31:12 -06:00
|
|
|
(provide 'advent-of-code)
|
|
|
|
|
|
|
|
;; Local Variables:
|
|
|
|
;; read-symbol-shorthands: (("aoc-" . "advent-of-code-"))
|
|
|
|
;; End:
|