-
Notifications
You must be signed in to change notification settings - Fork 0
/
excercises1.lsp
53 lines (49 loc) · 855 Bytes
/
excercises1.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
; This is a LISP file
; 1.1: Some Atoms
;; French
;; Fries
;; here
;; i
;; am
;; and
;; 5
;; is
;; magic
;; number
; 1.2: Some Lists
;; (French Fries)
;; (French)
;; (Fries)
;; (here i am)
;; (and 5 is)
;; (magic number)
;; ()
;; (5)
;; (is)
;; (and)
;; (is magic)
;; (French here i and is number)
;; (magic 5)
;; (number is magic)
;; (i here)
;; (French is magic)
;; (5 is magic)
;; (am i here)
;; (magic is magic)
;; (())
;; (is magic 5)
; 1.3
(defparameter *small* 1)
(defparameter *big* 100)
(defun guess-my-number ()
(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))