;;;; util.lisp -- some utilities (in-package :oneliners.api) (defun plist-find (indicator plist &key (test 'eq) (key 'identity)) (loop for (ind val . more) on plist by #'cddr when (funcall test indicator (funcall key ind)) return val)) (defmacro with-plist ((&rest keys) plist &rest body) (let ((the-plist (gensym))) `(let ((,the-plist ,plist)) (let ,(loop for key in keys collect `(,key (plist-find (symbol-name ',key) ,the-plist :test #'string-equal :key #'symbol-name))) ,@body))))