Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
Created July 16, 2013 21:50
Show Gist options
  • Save PuercoPop/6015465 to your computer and use it in GitHub Desktop.
Save PuercoPop/6015465 to your computer and use it in GitHub Desktop.
(defun merge-plists (list-a list-b)
"If a key from list-b does not exist in list-a add it to it."
(let ((*merged-list* (copy-list list-a)))
(declare (special *merged-list*))
(loop for key in list-b by #'cddr
do
(unless (getf list-a key)
(setf *merged-list* (append *merged-list* `(,key ,(getf list-b key))))))
*merged-list*))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment