Clojure binding does not work

I am working on Clojure examples in Stuart Halloway's “Clojure Programming” program, and when using bindings, I got trapped:

(def foo 10)
; => '#user/foo

foo
; => 10

(binding [foo 42] foo)
; => 10

(binding [user/foo 42] foo)
; => 10

(binding [user/foo 42] (var-get #'user/foo))
; => 10

Why won't it give me 42?

+3
source share
2 answers

Verdict: error

This is similar to a bug in 1.1.0-alpha-SNAPSHOT, and it also plays on Linux.

If you return to the Clojure d / l page, this version seems to have been removed, and 1.0.0 is the Recommended d / l.

And in 1.0.0, your example binds 42.

+3
source

:
  , . , , , - pmap map , . .

+1

Source: https://habr.com/ru/post/1720642/


All Articles