refactor the way oodml find-all and select deal with their keyword args.
[clsql.git] / sql / utils.lisp
index 7f307d63d2da32ce1c8a646df1cbd8b68ca432f9..60fedc3f971d4a8fd6b9b2d39471dfcb5350064d 100644 (file)
@@ -393,4 +393,15 @@ is replaced with replacement. [FROM http://cl-cookbook.sourceforge.net/strings.h
          when pos do (write-string replacement out)
            while pos)
     (unless stream
-      (get-output-stream-string out))))
\ No newline at end of file
+      (get-output-stream-string out))))
+
+
+(defun filter-plist (plist &rest keys-to-remove)
+  "Returns a copy of the given plist with indicated key-value pairs
+removed. keys are searched with #'MEMBER"
+  (declare (dynamic-extent keys-to-remove))
+  (when plist
+    (loop for (k v . rest) = plist then rest
+          unless (member k keys-to-remove)
+            collect k and collect v
+          while rest)))