Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started