Two forms:
[db relation-name tuple] removes the tuple from the named relation,
returns a new database.
[rel tuple] removes the tuple from the relation. Returns the new
relation.
(defn remove-tuple
"Two forms:
[db relation-name tuple] removes the tuple from the named relation,
returns a new database.
[rel tuple] removes the tuple from the relation. Returns the new
relation."
([db rel-name tuple] (assoc db rel-name (remove-tuple (db rel-name) tuple)))
([rel tuple]
(let [data (:data rel)
new-data (disj data tuple)]
(if (identical? data new-data)
rel
(let [idxs (remove-from-indexes (:indexes rel) tuple)]
(assoc rel :data new-data :indexes idxs))))))
Comments top
No comments for remove-tuple. Log in to add a comment.