Changes for clojure.core/disj!

jafingerhut on Wed, 22 Feb 2012
;; 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}
jafingerhut on Wed, 22 Feb 2012
;; 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=> (persistent! foo)
#{yukkuri slow pore-pore}
yasuto on Fri, 10 Jun 2011
user> (def foo (transient #{'pore-pore 'slow 'yukkuri}))
#'user/foo
user> (count foo)
3
user> (disj! foo 'yukkuri)
#<TransientHashSet clojure.lang.PersistentHashSet$TransientHashSet@4c69bdf8>
user> (count foo)
2
user> (conj! foo 'yukkuri)
#<TransientHashSet clojure.lang.PersistentHashSet$TransientHashSet@4c69bdf8>
user> (count foo)
3
user> (persistent! foo)
#{yukkuri slow pore-pore}
user>