Added lisp along with some study work

This commit is contained in:
2017-06-23 02:16:42 -07:00
parent 0523d93916
commit 0d49347cb7
10 changed files with 496 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
(defparameter *small* 1)
(defparameter *big* 100)
(defun guess-my-number ()
;; ash is the artithmetic shift function
;; Halvs the sum of the limits and shortens the result
;; ash, here, shifts the binary bits left or right (well, right in this case)
;; Which leads to the right most binary falling off
;; This is a binary search
(ash (+ *small* *big*) -1))
(defun smaller ()
(setf *big* (1- (guess-my-number)))
(guess-my-number))
(defun bigger ()
(setf *small* (1+ (guess-my-number)))
(guess-my-number))
(defun start-over ()
(defparameter *small* 1)
(defparameter *big* 100)
(guess-my-number))