1.3.0 permalink Arrow_down_16x16

disj!

clojure.core

  • (disj! set)
  • (disj! set key)
  • (disj! set key & ks)
Alpha - subject to change.
disj[oin]. Returns a transient set of the same (hashed/sorted) type, that
does not contain key(s).

1 Example top

  • ;; Note how we always use the return value of disj! and conj! in these examples
    ;; for all future modifications, rather than (incorrectly) ignoring the return
    ;; value and continuing to modify the original transient set.  See examples for
    ;; assoc! and dissoc! for more discussion and examples of this.
    
    user=> (def foo (transient #{'pore-pore 'slow 'yukkuri}))
    #'user/foo
    user=> (count foo)
    3
    user=> (def foo (disj! foo 'yukkuri))
    #'user/foo
    user=> foo
    #<TransientHashSet clojure.lang.PersistentHashSet$TransientHashSet@3bd840d9>
    user=> (count foo)
    2
    user=> (def foo (conj! foo 'yukkuri))
    #'user/foo
    user=> foo
    #<TransientHashSet clojure.lang.PersistentHashSet$TransientHashSet@3bd840d9>
    user=> (count foo)
    3
    user=> (def foo (persistent! foo))
    #'user/foo
    user=> foo
    #{yukkuri slow pore-pore}
    
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:2985 top

(defn disj!
  "Alpha - subject to change.
  disj[oin]. Returns a transient set of the same (hashed/sorted) type, that
  does not contain key(s)."
  {:added "1.1"
   :static true}
  ([set] set)
  ([^clojure.lang.ITransientSet set key]
   (. set (disjoin key)))
  ([set key & ks]
   (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.