Hi all,

I'm trying to retrieve all of the games from a list of games in LISP but am having trouble writing the function.

Here is the code:

(setf game-db '(
	((title "Call of Duty Modern Warfare 2")
	(genre "FPS")
	(platform "Xbox 360")
	(players "Multiplayer")
	(price 39.99))
	((title "Team Fortress 2")
	(genre "FPS")
	(platform "PC")
	(players "Multiplayer")
	(price 19.99))

... ; And so on...

And I wish to retrieve the details of 1 game. I tried the following code:

(defun retrieve-game (title)
	(assoc 'title games))

And if I type (retrieve-game "Team Fortress 2") I get NIL.

I am very confused, can anyone help me? :confused:

you need to pass assoc an associated list of cons'd cells. For example:

> (assoc 'foo '((foo . bar) (baz . blub) (oof . zab)))
(foo . bar)