(in-package :odb) (defun make-key (key value unique) (if unique key (progn (check-type value id-mixin) (cons key value)))) (defun %map-with-new-kv (map key value &key (unique t)) (map-with-new-kv map (make-key key value unique) value)) (define-modify-macro add-kv (&rest args) %map-with-new-kv) (defun %map-without-kv (map key value &key (unique t)) (map-without-kv map (make-key key value unique))) (define-modify-macro remove-kv (&rest args) %map-without-kv) (defun collection-with-new-object (collection object) (map-with-new-kv collection +unspecific+ object)) (define-modify-macro add-to (object) collection-with-new-object) (defun collection-without-object (collection object) (map-without-kv collection object)) (define-modify-macro remove-from (object) collection-without-object) (defmethod map-with-new-kv ((map t) key value) (prog1 map (setf (get-value map key) value))) (defun containsp (map object) (eq (get-value map object) object))