Skip to content

Commit

Permalink
Use memo function from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
iamFIREcracker committed Jan 28, 2024
1 parent 4575875 commit 0035682
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/2023/day12.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@
(list springs (extract-positive-integers groups))))


(defmacro memoizing ((ht &rest key-parts) &body body)
(with-gensyms (memo key)
`(let ((,memo ,ht)
(,key (list ,@key-parts)))
(multiple-value-bind (res res?) (gethash ,key ,memo)
(if res?
res
(setf (gethash ,key ,memo)
(block memo
,@body)))))))


(defun count-valid-arrangements (s)
(destructuring-bind (springs groups) (parse-condition-record s)
(bnd1 (memo (make-hash-table :test 'equal))
Expand Down

0 comments on commit 0035682

Please sign in to comment.