Hi,
On Feb 15, 7:37 pm, Аркадий Рост wrote:
> for example, using binding macro:
> (binding [a 5] ...do something...) ;;using vector to contain bindings.
Beware the Leopard!
user=> (def a 5)
#'user/a
user=> (declare b)
#'user/b
user=> (binding [a 1 b (inc a)] b)
6
user=> (let [a 1 b (inc a)] b)
On 15 February 2010 19:37, Аркадий Рост wrote:
> I don't understand the reason to make the argument binding-map:
with-binding* is used in the definition of bound-fn*, which seems like
a pretty useful thing to have. The reason it accepts a Var / value map
is probably the fact that that's what get-
Yeah.. That function is very confused. I didn't check it, sorry.
I don't understand the reason to make the argument binding-map:
for example, using binding macro:
(binding [a 5] ...do something...) ;;using vector to contain bindings.
but using with-bindings*:
(with-bindings* {#'a 5} f args) ;;has
On Mon, Feb 15, 2010 at 7:25 AM, Аркадий Рост wrote:
> Hi!
> I was playing a bit with with-bindings* function, but I got error
> every time.
>
> I've tried:
>
> (def a 5)
>
> (with-bindings* {a 3} println a) ;; got java.lang.Integer cannot be
> cast to clojure.lang.Var
>
> (with-bindings* [{a 3}]
On Feb 15, 12:03 pm, Аркадий Рост wrote:
> oh wait...I take a look on binding and with-binding*
> realesation.http://github.com/richhickey/clojure/blob/f4c58e3500b3668a0941ca21f9a...
> Why with-binding* function wasn't write like this:
> (defn with-bindings*
> [bindings f & args]
> (assert-a
oh wait...I take a look on binding and with-binding* realesation.
http://github.com/richhickey/clojure/blob/f4c58e3500b3668a0941ca21f9aa4f444de2c652/src/clj/clojure/core.clj#L1251
Why with-binding* function wasn't write like this:
(defn with-bindings*
[bindings f & args]
(assert-args binding
thanks)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email
Hi,
On Feb 15, 6:49 am, Аркадий Рост wrote:
> ok...Then what was the reason to use map instead of vector as usually?
with-bindings* is a low-level function. It pushes the given map of var/
values onto the stack of thread local bindings and takes care to
remove it correctly after the given funct
ok...Then what was the reason to use map instead of vector as usually?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient wit
(with-bindings* {#'a 3} println a)
with-bindings* expects the keys of the bindings map to be Vars, not symbols.
Sincerely,
Michał
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that
Hi!
I was playing a bit with with-bindings* function, but I got error
every time.
I've tried:
(def a 5)
(with-bindings* {a 3} println a) ;; got java.lang.Integer cannot be
cast to clojure.lang.Var
(with-bindings* [{a 3}] println a) ;;got
clojure.lang.PersistentArrayMap cannot be cast to
clojure
11 matches
Mail list logo