Example execution for Problem #6


Below is a sequence of function calls and the output they produce, testing most of the required functionality that you must implement for Problem #6. As usual user input is shown in red


CL-USER(1): :ld problem6.cl
; Loading problem6.cl

CL-USER(2): (defvar *db* NIL)
*DB*

CL-USER(3): (db_insert (db_makebug 6 2 "red" 2 "black" .5))
1

CL-USER(4): (db_insert (db_makebug 52 4 "green" 0 "brown" 6))
2

CL-USER(5): (db_insert (db_makebug 6 2 "green" 2 "black" .6))
3

CL-USER(6): (db_insert (db_makebug 8 12 "red" 0 "yellow" 1))
4

CL-USER(7): (db_insert (db_makebug 0 0 "none" 0 "grey" 5))
5

CL-USER(8): (db_print)
legs: 2
eyes: 6
eye color: red
wings: 2
color: black
length: 0.5
------------------
legs: 52
eyes: 4
eye color: green
wings: 0
color: brown
length: 6
------------------
legs: 6
eyes: 2
eye color: green
wings: 2
color: black
length: .6
------------------
legs: 8
eyes: 12
eye color: red
wings: 0
color: yellow
length: 1
------------------
legs: 0
eyes: 0
eye color: none
wings: 0
color: grey
length: 5
------------------
5


CL-USER(9): (keep-if-true #'(lambda (x) (= (mod x 2) 0)) '(2 3 5 8 7 4 2))
(2 8 4 2)

CL-USER(10): (db_select (color_selector "black"))
((:LEGS 6 :EYES 2 :EYECOLOR "green" :WINGS 2 :COLOR "black" :LENGTH 0.6)
(:LEGS 2 :EYES 6 :EYECOLOR "red" :WINGS 2 :COLOR "black" :LENGTH 0.5))

CL-USER(11): (db_select (where :eyecolor "green"))
((:LEGS 6 :EYES 2 :EYECOLOR "green" :WINGS 2 :COLOR "black" :LENGTH 0.6)
(:LEGS 52 :EYES 4 :EYECOLOR "green" :WINGS 0 :COLOR "brown" :LENGTH 6))

CL-USER(12): (db_select (where :eyecolor "green" :eyes 4))
((:LEGS 52 :EYES 4 :EYECOLOR "green" :WINGS 0 :COLOR "brown" :LENGTH 6))

CL-USER(13): (db_select (where :eyecolor "green" :eyes 4 :color "black"))
NIL

CL-USER(14): (db_update (where :eyecolor "green") :wings 0 :legs 8)
2

CL-USER(15): (db_select (where :eyecolor "green"))
((:LEGS 8 :EYES 2 :EYECOLOR "green" :WINGS 0 :COLOR "black" :LENGTH .6)
(:LEGS 8 :EYES 4 :EYECOLOR "green" :WINGS 0 :COLOR "brown" :LENGTH 6))