add transducers, some small refactors
This commit is contained in:
parent
f7bda050dd
commit
9dbbe1df62
3 changed files with 3 additions and 1 deletions
1
aoc.asd
1
aoc.asd
|
@ -18,6 +18,7 @@
|
|||
#:queues.simple-queue
|
||||
#:bt-semaphore ; threads higher level lib
|
||||
#:trivia ; community standard pattern matching
|
||||
#:transducers
|
||||
)
|
||||
:components ((:module "src"
|
||||
:components
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
|
||||
(defun guard-path (labo guard &optional (path (make-hash-table :size 10000)) (extra-block nil))
|
||||
(let ((hash (guard-hash guard)))
|
||||
(format t "~A~%" guard)
|
||||
(cond
|
||||
((not guard) (remove-duplicates (loop for k being the hash-keys of path collect (floor (/ k 10)))))
|
||||
((gethash hash path) nil)
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
"returns simplified equation after applying the * operator or nil if not possible"
|
||||
(let ((r (equation-result equation))
|
||||
(os (equation-operands equation)))
|
||||
(and (= (gcd r (first os)) (first os))
|
||||
(and (zerop (mod r (first os)))
|
||||
(make-equation :result (/ r (first os)) :operands (cdr os)))))
|
||||
|
||||
(defun plus-branch (equation)
|
||||
|
|
Loading…
Reference in a new issue