You're viewing version 1.2.0 of persistent!. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

persistent!

clojure.core

  • (persistent! coll)
Alpha - subject to change.
Returns a new, persistent version of the transient collection, in
constant time. The transient collection cannot be used after this
call, any such use will throw an exception.

1 Example top

  • user> (def foo (transient [1 2 3]))
    #'user/foo
    user> foo
    #<TransientVector clojure.lang.PersistentVector$TransientVector@12c9b4d1>
    user> (persistent! foo)
    [1 2 3]
    user> foo
    #<TransientVector clojure.lang.PersistentVector$TransientVector@12c9b4d1>
    user> (conj! foo 4)
    → ERROR:Transient used after persistent! call
    user> (persistent! foo)
    → ERROR: Transient used after persistent! call
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:2544 top

(defn persistent! 
  "Alpha - subject to change.
  Returns a new, persistent version of the transient collection, in
  constant time. The transient collection cannot be used after this
  call, any such use will throw an exception."
  {:added "1.1"}
  [^clojure.lang.ITransientCollection coll]
  (.persistent coll))
Vars in clojure.core/persistent!: defn
Used in 3 other vars frequencies into group-by

Comments top

No comments for persistent!. Log in to add a comment.