• (disj set)
  • (disj set key)
  • (disj set key & ks)
disj[oin]. Returns a new set of the same (hashed/sorted) type, that
does not contain key(s).

1 Example top

  • user=> (disj #{1 2 3}) ; disjoin nothing 
    #{1 2 3} 
    
    user=> (disj #{1 2 3} 2) ; disjoin 2
    #{1 3} 
    
    user=> (disj #{1 2 3} 4) ; disjoin not existed item
    #{1 2 3} 
    
    user=> (disj #{1 2 3} 1 3) ; disjoin several items at once
    #{2}
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:1411 top

(defn disj
  "disj[oin]. Returns a new set of the same (hashed/sorted) type, that
  does not contain key(s)."
  {:added "1.0"
   :static true}
  ([set] set)
  ([^clojure.lang.IPersistentSet set key]
   (when set
     (. set (disjoin key))))
  ([set key & ks]
   (when set
     (let [ret (disj set key)]
       (if ks
         (recur ret (first ks) (next ks))
         ret)))))
Vars in clojure.core/disj:
Used in 0 other vars

Comments top

No comments for disj. Log in to add a comment.