1.2.0 permalink Arrow_down_16x16
  • (remove-tuple db rel-name tuple)
  • (remove-tuple rel 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.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/datalog/database.clj:190 top

(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))))))
Vars in clojure.contrib.datalog.database/remove-tuple: assoc defn identical? let
Used in 0 other vars

Comments top

No comments for remove-tuple. Log in to add a comment.