# HG changeset patch # User Steve Losh # Date 1541123970 14400 # Node ID 0ea8cfbf45ce347cdf67113d8e483c92fa9cedb1 # Parent 6088027147e180bb918eb01549d2dda372a584de Clean up diff -r 6088027147e1 -r 0ea8cfbf45ce src/problems/gc.lisp --- a/src/problems/gc.lisp Thu Nov 01 21:54:39 2018 -0400 +++ b/src/problems/gc.lisp Thu Nov 01 21:59:30 2018 -0400 @@ -52,4 +52,4 @@ ;; (problem-gc *input-gc*) -;; (solve problem-gc) +;; (solve gc) diff -r 6088027147e1 -r 0ea8cfbf45ce src/problems/hamm.lisp --- a/src/problems/hamm.lisp Thu Nov 01 21:54:39 2018 -0400 +++ b/src/problems/hamm.lisp Thu Nov 01 21:59:30 2018 -0400 @@ -17,4 +17,4 @@ (hamming (read-line data) (read-line data) :test #'char=)) ;; (problem-hamm *input-hamm*) -;; (solve problem-hamm) +;; (solve hamm) diff -r 6088027147e1 -r 0ea8cfbf45ce src/utils.lisp --- a/src/utils.lisp Thu Nov 01 21:54:39 2018 -0400 +++ b/src/utils.lisp Thu Nov 01 21:59:30 2018 -0400 @@ -46,20 +46,9 @@ (defun make-buffer (&optional (capacity 64)) (make-array capacity :element-type 'character :adjustable t :fill-pointer 0)) -(defun round-to (number precision) - "Round `number` to the given `precision`. - - Examples: - - (round-to 13 10) ; => 10 - (round-to 15 10) ; => 20 - (round-to 44 25) ; => 50 - (round-to 457/87 1/2) ; => 11/2 - - " - (* precision (round number precision))) - (defun hamming (sequence1 sequence2 &key (test #'eql)) + "Return the Hamming distance between `sequence1` and `sequence2`." + ;; todo assert length=? (let ((result 0)) (map nil (lambda (x y) (unless (funcall test x y) @@ -124,6 +113,6 @@ (with-open-file (input (problem-data-path problem)) (pbcopy (funcall problem input)))) -(defmacro solve (problem) - `(solve% ',problem)) +(defmacro solve (name) + `(solve% ',(symb 'problem- name)))