r5408: *** empty log message ***
[kmrcl.git] / lists.lisp
index ed2148ee347cba703e88b21cd44a1f400df42288..285bb397f426333f8b3eac243144c8704d08eb05 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Apr 2000
 ;;;;
-;;;; $Id: lists.lisp,v 1.6 2003/06/18 17:12:29 kevin Exp $
+;;;; $Id: lists.lisp,v 1.8 2003/07/05 02:32:08 kevin Exp $
 ;;;;
 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
       ((null pl) alist)
     (setq alist (acons (car pl) (cadr pl) alist))))
 
-(defun get-plist (key plist &key (test 'eql) (missing nil))
-  (let-if (pos (member key plist :test test))
-         (cadr pos)
-         missing))
+(defmacro update-plist (pkey value plist &key (test '#'eql))
+  "Macro to support below (setf get-alist)"
+  (let ((pos (gensym)))
+    `(let ((,pos (member ,pkey ,plist :test ,test)))
+       (if ,pos
+          (progn
+            (setf (cadr ,pos) ,value)
+            ,plist)
+        (setf ,plist (append ,plist (list ,pkey ,value)))))))
+
+