1.3.0 permalink Arrow_down_16x16

with-bindings*

clojure.core

  • (with-bindings* binding-map f & args)
Takes a map of Var/value pairs. Installs for the given Vars the associated
values as thread-local bindings. Then calls f with the supplied arguments.
Pops the installed bindings after f returned. Returns whatever f returns.

1 Example top

  • user=> (let [f (fn [] *warn-on-reflection*)]
             (with-bindings* {#'*warn-on-reflection* true} f))
    true
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:1760 top

(defn with-bindings*
  "Takes a map of Var/value pairs. Installs for the given Vars the associated
  values as thread-local bindings. Then calls f with the supplied arguments.
  Pops the installed bindings after f returned. Returns whatever f returns."
  {:added "1.1"
   :static true}
  [binding-map f & args]
  (push-thread-bindings binding-map)
  (try
    (apply f args)
    (finally
      (pop-thread-bindings))))
Vars in clojure.core/with-bindings*:
Used in 0 other vars

Comments top

No comments for with-bindings*. Log in to add a comment.