(load "pr4") (print (format nil "~%Beginning to store..(3)")) (print (storep g1 ( (weight . 1) (height . 15) (sex . M) (univ . A) (year . 10) (age . 20) (salary . 1) (homestate . A) (married . Y) (kidnames . nil) )) ) (print (storep g2 ( (weight . 2) (height . 14) (sex . M) (univ . B) (year . 20) (age . 20) (salary . 2) (homestate . B) (married . N) (kidnames . nil) )) ) (print (storep g3 ( (weight . 3) (height . 13) (sex . M) (univ . C) (year . 30) (age . 20) (salary . 3) (homestate . C) (married . Y) (kidnames . nil) )) ) (print (storep c1 ( (weight . 4) (height . 12) (sex . F) (univ . A) (year . 40) (age . 30) (salary . 4) (homestate . A) (married . N) (kidnames . (c11 c12)) )) ) (print (storep c2 ( (weight . 5) (height . 11) (sex . F) (univ . B) (year . 40) (age . 30) (salary . 5) (homestate . B) (married . Y) (kidnames . nil) )) ) (print (storep c3 ( (weight . 6) (height . 10) (sex . F) (univ . C) (year . 30) (age . 30) (salary . 6) (homestate . C) (married . N) (kidnames . (c31)) )) ) (print (storep m1 ( (weight . 7) (height . 9) (sex . M) (univ . A) (year . 20) (age . 40) (salary . 7) (homestate . A) (married . Y) (kidnames . nil) )) ) (print (storep m2 ( (weight . 8) (height . 8) (sex . F) (univ . B) (year . 10) (age . 40) (salary . 8) (homestate . B) (married . N) (kidnames . nil) )) ) (print (storep m3 ( (weight . 9) (height . 7) (sex . M) (univ . C) (year . 10) (age . 40) (salary . 9) (homestate . C) (married . Y) (kidnames . nil) )) ) (print (storep l1 ( (weight . 10) (height . 6) (sex . F) (univ . A) (year . 20) (age . 20) (salary . 10) (homestate . A) (married . N) (kidnames . (l11 l12)) )) ) (print (storep l2 ( (weight . 11) (height . 5) (sex . M) (univ . B) (year . 30) (age . 20) (salary . 11) (homestate . B) (married . Y) (kidnames . nil) )) ) (print (storep l3 ( (weight . 12) (height . 4) (sex . F) (univ . C) (year . 40) (age . 20) (salary . 12) (homestate . C) (married . N) (kidnames . nil) )) ) (print (storep p1 ( (weight . 13) (height . 3) (sex . M) (univ . A) (year . 40) (age . 30) (salary . 13) (homestate . A) (married . Y) (kidnames . nil) )) ) (print (storep p2 ( (weight . 14) (height . 2) (sex . F) (univ . B) (year . 30) (age . 30) (salary . 14) (homestate . B) (married . N) (kidnames . (p21)) )) ) (print (storep p3 ( (weight . 15) (height . 1) (sex . M) (univ . C) (year . 20) (age . 30) (salary . 15) (homestate . C) (married . Y) (kidnames . (p31 p32 p33)) )) ) (print (format nil "~%Done storing")) (print (format nil "~%Inserting now.. all should be successful..(3)")) (print (insertp g3 general)) (print (insertp g2 general)) (print (insertp g1 general)) (print (insertp c3 colonel)) (print (insertp c2 colonel)) (print (insertp c1 colonel)) (print (insertp l3 lieutenant)) (print (insertp l2 lieutenant)) (print (insertp l1 lieutenant)) (print (insertp m3 major)) (print (insertp m2 major)) (print (insertp m1 major)) (print (insertp p3 private)) (print (insertp p2 private)) (print (insertp p1 private)) (print (format nil "~%this insert shouldn't work..(1)")) (print (insertp p36 private)) (print (format nil "Result: NIL")) (print (format nil "~%this set does not exist..(1)")) (print (insertp m3 noset)) (print (format nil "Result: NIL")) (print (format nil "~%Finding all with weight less-than-equal 8(1)")) (print (findall (lep weight 8))) (print (format nil "Result: M2 M1 C3 C2 C1 G3 G2 G1")) (print (format nil "~%Finding next with height 14(1)")) (print (findnext (eqp height 14))) (print (format nil "Result: G2")) (print (format nil "~%and the next one(1)")) (print (findnext (eqp height 14))) (print (format nil "Result: G2")) (print (format nil "~%and the next with height greater than 16 when none exist..(1)")) (print (findnext (gep height 16))) (print (format nil "Result: NIL")) (print (format nil "~%find the next in general set..(1)")) (print (findnextinset general (gep weight 0) )) (print (format nil "Result: G1")) (print (format nil "~%and the next..(0.5)")) (print (findnextinset general t)) (print (format nil "Result: G2")) (print (format nil "~%and the next..(0.5)")) (print (findnextinset general (gep weight 0))) (print (format nil "Result: G3")) (print (format nil "~%finding any with salary 1 and university A..(1)")) (print (findany (and (eqp univ A) (eqp salary 1)))) (print (format nil "Result: G1")) (print (format nil "~%finding a female lieutenant..(1)")) (print (findanyinset lieutenant (eqp sex F))) (print (format nil "Result: L1 or L3")) (print (format nil "~%trying to delete a non-existent lieutenant(1)")) (print (removep l4 lieutenant)) (print (format nil "Result: NIL or TRUE depending on your decision")) (print (format nil "~%should be able to remove l3 though..(1)")) (print (removep l3 lieutenant)) (print (format nil "Result: any non-NIL value")) (print (format nil "~%checking if still in lieutenant set..(1)")) (print (findallinset lieutenant (gep weight 0))) (print (format nil "Result: L1 L2")) (print (format nil "~%should not be gone from the officers list..(1)")) (print (findall (eqp weight 12))) (print (format nil "Result: L3")) (print (format nil "~%trying to delete non-existent officer..(1)")) (print (deletep g4)) (print (format nil "Result: NIL or TRUE depending on your decision")) (print (format nil "~%this delete should remove both from officers and general..(1)")) (print (deletep g3)) (print (format nil "Result: Any non-NIL value")) (print (format nil "~%check officers..(1)")) (print (findall (ltp weight 4))) (print (format nil "Result: G2 G1")) (print (format nil "~%check general..(1)")) (print (findallinset general (ltp weight 4))) (print (format nil "Result: G2 G1")) (print (format nil "~%non-existent colonel grows taller..(1)")) (print (modifyp c10 height 200)) (print (format nil "Result: NIL")) (print (format nil "~%colonel c1 gets richer..(1)")) (print (modifyp c1 salary 300)) (print (format nil "Result: Any non-NIL value")) (print (format nil "~%Check Insertion..(1)")) (print (findall (gep salary 20))) (print (format nil "Result: C1")) (print (format nil "~%let's try a complicated query..(3)")) (print (findall (and (not (eqp sex M)) (or (ltp salary 4) (gep salary 10))))) (print (format nil "Result: C1 L1 L3 P2~%"))