https://github.com/fukamachi/multival-plist.git
git clone 'https://github.com/fukamachi/multival-plist.git'
(ql:quickload :multival-plist)
(defparameter *plist* '(:foo 1 :bar 2 :foo 3))
(getf *plist* :foo)
;=> 1
(getf-all *plist* :foo)
;=> (1 3)
(remf-all *plist* :foo)
;=> T
(getf-all *plist* :foo :undef)
;=> :UNDEF
Multival-Plist provides utilities to handle Property Lists that may contain multiple values per key.
*plist*
;=> (:FOO 1 :BAR 2 :FOO 3)
(getf *plist* :foo)
;=> 1
(getf-all *plist* :foo)
;=> (1 3)
This is a version of getf
enabled to manage multiple keys. If the plist
has two or more pairs that they have given key
as a key, returns the values of each pairs as one list.
(setf (getf-all *plist* :foo) '("Hello" "World"))
;; *plist* = '(:foo "Hello" :bar 2 :foo "World")
;; same as (setf (getf-all *plist* :foo) '(3000))
(setf (getf-all *plist* :foo) 3000)
;; *plist* = '(:foo 3000 :bar 2)
Changes the stored value(s) of the given key
. This removes or adds pairs as necessary to store the new list.
(remf-all *plist* :foo)
Removes a key and associated values for the given key
.
Copyright (c) 2012 Eitarow Fukamachi (e.arrows@gmail.com)
Licensed under the LLGPL License.