I've written a function to rate games and return a list of the games with their rating, but I am having trouble getting it to return the list properly. It either returns the list with their ratings as 0 or as 1, never more like it should. I have worked on this function for a while now and no matter how many times I've rewritten it, and tried imagining what it is returning, I just can't seem to get it to work! It makes sense in my head, but doesn't seem to work in Lisp. The code is below:
Code: Select all
(setf game-list '(((title "New Super Mario Bros. Wii") (genre "Platform") (platform "Wii") (price 20))
((title "Quake") (genre "First Person Shooter") (platform "PC") (price 5)))
Code: Select all
(defun rate (a-list &optional title genre platform price)
(setf rated-games nil)
(dolist (elem a-list)
Code: Select all
(rate game-list nil "Platform" "Wii" nil)