Coding Exercise Run

CIS447

 

#<OUTPUT BUFFERED FILE-STREAM CHARACTER #P"sho-egs" @1>

[2]> (load "examples.cl")

;; Loading file examples.cl ...

;; Loading of file examples.cl is finished.

T

[3]> (is-square 44)

NIL

[4]> (is-square 49)

T

[5]> (trynumber 44)

NIL

[6]> (trynumber 49)

7

[7]> (trynumbers '(44 49 11 16 18 31 35 36 99 100))

7

[8]> (trynumbers nil)

NIL

[9]> (setf n1 '(1 2 3 4 5 6 7 8 9))

(1 2 3 4 5 6 7 8 9)

[10]> (setf n2 '(4 9 16))

(4 9 16)

[11]> (setf n3 '(2 3 5 9 12 16 19))

(2 3 5 9 12 16 19)

[12]> (setf n4 '(2 3 5))

(2 3 5)

[13]> (trynumbers n1)

1

[14]> (mapcar #'trynumbers '(n1 n2 n3 n4))

 

*** - FIRST: N1 is not a list

1. Break [15]> :a

 

[16]> (mapcar #'eval '(n1 n2 n3 n4))

((1 2 3 4 5 6 7 8 9) (4 9 16) (2 3 5 9 12 16 19) (2 3 5))

[17]> (setf lol (mapcar #'eval '(n1 n2 n3 n4)))

((1 2 3 4 5 6 7 8 9) (4 9 16) (2 3 5 9 12 16 19) (2 3 5))

[18]> (mapcar #'trynumbers lol)

(1 2 3 NIL)

[19]> (trynumbers n1)

1

[20]> (trynumbers n2)

2

[21]> (trynumbers n3)

3

[22]> (trynumbers n4)

NIL

[23]> (mapcar #'checknums lol)

(NIL T NIL NIL)

[24]> (setf *triples* nil)

NIL

[25]> (add-triple 1 2 3)

2

[26]> *triples*

((1 2 3))

[27]> (add-triple '(a b c))

 

*** - EVAL/APPLY: too few arguments given to ADD-TRIPLE

1. Break [28]> :a

 

[29]> (add-triple a b c)

 

*** - EVAL: variable A has no value

1. Break [30]> :a

 

[31]> (add-triple 'a 'b 'c)

B

[32]> *triples*

((A B C) (1 2 3))

[33]> (add-triple '(1 a) '(b 2) '(zz 99))

(B 2)

[34]> *triples*

(((1 A) (B 2) (ZZ 99)) (A B C) (1 2 3))

[35]> (setf *4tuples*

'((a b 1 2)(1 2 3 4)((a b)(c d)(e f)(g h))(a z video store)(b z bbk ccf)))

((A B 1 2) (1 2 3 4) ((A B) (C D) (E F) (G H)) (A Z VIDEO STORE) (B Z BBK CCF))

[36]> *4tuples*

((A B 1 2) (1 2 3 4) ((A B) (C D) (E F) (G H)) (A Z VIDEO STORE) (B Z BBK CCF))

[37]> (value-of '(b z bbk ccf))

BBK

[38]> (is-second 'c '(d c talk record))

T

[39]> (pluck 'b *4tuples*)

1

[40]> (pluck 2 *4tupels*)

 

*** - EVAL: variable *4TUPELS* has no value

1. Break [41]> :a

 

[42]> (pluck 2 *4tuples*)

3

[43]> (pluck '(c d) *4tuples*)

NIL

[44]> (pluck 'z *4tuples*)

VIDEO

[45]> (pluck 'f *4tuples*)

NIL

[46]> (defun is-second (item list)(equal item (second list)))

IS-SECOND

[47]> (pluck '(c d) *4tuples*)

(E F)

[48]> (defun is-second (item list)(eq item (second list)))

IS-SECOND

[49]> (setf *4tuples*

'((a "say hello" h hh)(b "say bye bye" g hh)(c "yikes" e f)))

((A "say hello" H HH) (B "say bye bye" G HH) (C "yikes" E F))

[50]> *4tuples*

((A "say hello" H HH) (B "say bye bye" G HH) (C "yikes" E F))

[51]> (string-of (first *4tuples*))

"say hello"

[52]> (pluck&use 'a *4tuples*)

NIL

[53]>  (pluck&use 'b *4tuples*)

NIL

[54]>  (pluck&use 'h *4tuples*)

 

"say hello" hello

HELLO

[55]>  (pluck&use 'g *4tuples*)

 

"say bye bye" hello

HELLO

[56]>  (pluck&use 'g *4tuples*)

 

"say bye bye" bye

BYE

[57]>  (pluck&use 'e *4tuples*)

 

"yikes" yow

YOW

[58]> (setf lol '((a b 1 2)(1 2 3 4)(c b 9 7)(b 2 b 9)(1 b e f)(99 2 99 3)))

((A B 1 2) (1 2 3 4) (C B 9 7) (B 2 B 9) (1 B E F) (99 2 99 3))

[59]> lol

((A B 1 2) (1 2 3 4) (C B 9 7) (B 2 B 9) (1 B E F) (99 2 99 3))

[60]> (getlists 'b lol)

((A B 1 2) (C B 9 7) (1 B E F))

[61]> (getlists a lol)

 

*** - EVAL: variable A has no value

1. Break [62]> :a

 

[63]> (getlists 'a lol)

NIL

[64]> (getlists 2 lol)

((1 2 3 4) (B 2 B 9) (99 2 99 3))

[65]> (getlists 3 lol)

NIL

[66]> (ask&check "Type hello" '(hello))

 

"Type hello" bye

 

"Invalid input - valid values are:"

(HELLO) hello

HELLO

[67]> (ask&check

"type a form of hello" '(hello hi zup))

 

"type a form of hello" zup

ZUP

[68]> (ask&check

"What day is today?" '(Sunday Monday Tuesday Wednesday Thursday Friday Saturday))

 

"What day is today?" Monday

MONDAY

[69]>

(what-is-it? 9)

3

[70]> (what-is-it? 27)

729

[71]> (what-is-it? 15)

5

[72]> (what-is-it? 31)

"Neither a square, cube nor triple"

[73]> (run-what)

 

"Input a number or quit" 3

 

1

"Input a number or quit" 9

 

3

"Input a number or quit" 27

 

729

"Input a number or quit" 15

 

5

"Input a number or quit" 31

 

"Neither a square, cube nor triple"

"Input a number or quit" 41

 

"Neither a square, cube nor triple"

"Input a number or quit" 49

 

7

"Input a number or quit" 54

 

18

"Input a number or quit" q

 

"Invalid entry"

"Input a number or quit" exit

DONE

[74]> (dribble)