;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; property lists in lisp (not using built in get/setf get) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defvar *table* nil) (defun get (category key) (let ((cat-keys (assoc category *table*))) (if (not cat-keys) nil (let ((key-value-pair (assoc key (cadr cat-keys)))) (if (not key-value-pair) nil (cadr key-value-pair)))))) (defun put (category key new-value) (let ((cat-keys (assoc category *table*))) (if (not cat-keys) (setf *table* (cons (list category (list (list key new-value))) *table*)) (let ((key-value-pair (assoc key (cadr cat-keys)))) (if (not key-value-pair) (setf (cadr cat-keys) (cons (list key new-value) (cadr cat-keys))) (setf (cadr key-value-pair) new-value)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; EOF. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;