Extend criteria type
The criteria type should also be a predicate function. (this is what is documented). So we may write:
(defun universe-named (name)
(lambda (ptree)
(let ((universe (getf ptree :universe)))
(and universe
(string= name (getf universe :name))))))
(query *multiverse* (universe-named "marvel"))
instead of:
(query *multiverse* '((string= :name "marvel")))
--> ((:name "marvel" :stores
((:store
(:name "wolverine" :collections ((:collection (:name "stats" :label "Statistics" :document-type "statistics")))
:document-types
((:document-type
(:name "statistics" :label "Statistics" :elements
((:element
(:name :id :label "Id" :concrete-type :string :attributes
((:attribute (:name :display :value t)) (:attribute (:name :editable :value t))))))
:documentation "Cool statistics."))))))))
Note that there's an ambiguity in the symbolic criteria such as ((string= :name "marvel"))
:
plists at different levels can have the same indicator! Using such criteria may select plists of different depths, and of different types.
Edited by Pascal J. Bourguignon