Hi, I am a Clojure beginner, but I am definitely staying for more! I
heard about Clojure when Guy Steele mentioned it (just as a subtle
remark) in a talk about Fortress at JAOO 2008. Thought that when he
mentions it, it will probably be worth taking a look ;-)
WOW. I've just seen the web presentations and read the website, and I
was just blow away. Very cool. Rich you are my new hero :-)
Anyway, I was running through the examples of the site with a REPL by
my side. And I noticed something wierd. It's the rebind example from
http://clojure.org/concurrent_programming. Here is the output.
krukow:~/languages/clojure/trunk$ cl
Clojure
user=> (defn loves [x y]
(str x " loves " y))
#'user/loves
user=> (defn test-rebind []
(println (loves "ricky" "lucy"))
(let [str-orig str]
(binding [str (fn [& args]
(println "Logging str")
(apply str-orig args))]
(println (loves "fred" "ethel")))))
#'user/test-rebind
user=> (test-rebind)
ricky loves lucy
Logging str
Logging str
Logging str
Logging str
Logging str
fred loves ethel
nil
user=>
Now the question is why is it logging 5 times? Is this a bug, or has
something fundamental changed? I checked out Clojure from SVN a few
days ago.
krukow:~/languages/clojure/trunk$ svn info
Path: .
URL:
https://clojure.svn.sourceforge.net/svnroot/clojure/trunk
Repository Root:
https://clojure.svn.sourceforge.net/svnroot/clojure
Repository UUID: b4165764-bd0f-0410-b771-ab16a44d2305
Revision: 1051
Node Kind: directory
Schedule: normal
Last Changed Author: rhickey
Last Changed Rev: 1051
Last Changed Date: 2008-10-05 17:02:27 +0200 (Søn, 05 Okt 2008)
Cheers,
- Karl