Skip to content

Instantly share code, notes, and snippets.

@ikemonn
Created January 5, 2014 04:25
Show Gist options
  • Save ikemonn/8264306 to your computer and use it in GitHub Desktop.
Save ikemonn/8264306 to your computer and use it in GitHub Desktop.
Lisp binary search
(defun smaller()
(setf *big* (1- (guess-my-number)))
(guess-my-number))
(defun bigger()
(setf *small* (1+ (guess-my-number)))
(guess-my-number))
(defun guess-my-number()
(ash (+ *small* *big*) -1))
(defun start-over ()
(defparameter *small* 1)
(defparameter *big* 100)
(guess-my-number))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment