Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a question about lisp programming. I want to use the key '(Likes Robbie Samantha) to find the value T, but my code keeps

I have a question about lisp programming. I want to use the key '(Likes Robbie Samantha) to find the value T, but my code keeps giving me the value NIL. I don't know why. I have attached my code below. It is in lisp.

(defun my-func()

(defparameter *KB* (make-hash-table))

(setf (gethash '(ROBOT ROBBIE) *KB*)'T) (setf (gethash '(Likes Robbie Samantha) *KB*) 'T) (setf (gethash '(Dog Rover) *KB*) T) (setf (gethash '(Bark Rover) *KB*) T) (setf (gethash '(Likes Robbie Chocolate) *KB*) T) (setf (gethash '(Lives Robbie California) *KB*) T) (setf (gethash '(Likes Robbie ice-cream) *KB*) T) (setf (gethash '(Eats Robbie petrol) *KB*) T) (format t "Please enter a well formed function ~% ") (terpri) (setq a (read-delimited-list #\~)) (print a) (terpri) (format t "~a ~%" (gethash '(Likes Robbie Samantha) *KB*)) (format t "~a ~%" (gethash 'a *KB*)) (terpri) )

(my-func)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago