3. A simple database

Created Tuesday 28 January 2014


Make a list:
(list 1 2 3)

Make a plist (property list):
(list :a 1 :b 2 :c 3)
:something — keyword(add-record (make-cd "Roses" "Kathy" 7 t))

Get plist and return a value for keyword symbol:
(getf (list :a 1 :b 2 :c 3) :b)

Define simple function:
(defun make-cd (title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))

Define global variable:
(defvar *db* nil)

Define add-record function:
(defun add-record (cd) (push cd *db*))

Add record:
(add-record (make-cd "Roses" "Kathy" 7 t))

Check the current vaue of *db*: