0ea8cfbf45ce

Clean up
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 01 Nov 2018 21:59:30 -0400
parents 6088027147e1
children bd06f66ba88f
branches/tags (none)
files src/problems/gc.lisp src/problems/hamm.lisp src/utils.lisp

Changes

--- 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)
--- 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)
--- 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)))