-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lisp
executable file
·35 lines (31 loc) · 1.1 KB
/
main.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/sbcl --script
(format t "------------------------------------ loading common~%")
(if (not (boundp '*common-loaded*))
(if (not (load "common.lisp" :if-does-not-exist nil))
(load "../common.lisp")))
(defun cmd-args ()
(or
#+CLISP *args*
#+SBCL *posix-argv*
#+LISPWORKS system:*line-arguments-list*
#+CMU extensions:*command-line-words*
nil))
(defvar *aoc-day*)
(defun run-day (day)
(setf *aoc-day* (if (every #'digit-char-p day)
(format nil "~2,'0d" (parse-integer day))
day))
(format t "------------------------------------ running ~a~%" *aoc-day*)
(if (load (format nil "~a/solution.lisp" *aoc-day*) :if-does-not-exist nil)
(time (day-main))
(format t "Solution for ~a not found~%" *aoc-day*)))
(when (equal (length (cmd-args)) 2)
(cond
((equal "all" (nth 1 (cmd-args)))
(loop for d from 1 to 25
collect
(run-day (format nil "~d" d))))
((equal "template" (nth 1 (cmd-args)))
(run-day (nth 1 (cmd-args))))
((every #'digit-char-p (nth 1 (cmd-args)))
(run-day (nth 1 (cmd-args))))))