In fact, keywords are not symbols. So thats why you were wrong.
You can read about in on the page http://clojure.org/lisps
--
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 f
Hi!
It turned out that special forms are behaving strangely when you try
to redefine them.
For example,
(defn def [& more]
(println "smth"))
but when you try to use this function you'll got unexpected behavior.
(def 5) - you'll got an exeption
There is another situation when you use let.
(le
ok. 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 em
Hi!
hmm...I don't understand why clojure when and if simultaneously? What
is the diffirences between them and when I should use one instead
another one?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@goog
It seems I have an example that shows difference between commute and
alter.
Here it is:
(defn my-inc [x] (dosync (Thread/sleep 1000) (inc x)))
alter***
(def x (ref 0))
(do
(def fut (future (do (Thread/sleep 300) (dosync (alter x inc))
@x)))
(dosync (println @x)(alter x my-inc)(pr
hmm..but in what way I can write code to demonstrate the difference?
--
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
Hi!
I don't understand difference between commute and alter. In fact I
don't understand how can I get different results by changing alter to
commute in code.I've read that the in-transaction value with commute
is that it may differ from the post-commit value, as the effect of
commute is a function
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
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
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
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
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
And one more, when and why "methods" should be used? (except main)
--
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 yo
Oh...So to make methods I must declare them in gen-class clause and if
some function wasn't include in gen-class clause, it wouldn't be a
method even if it had a prefix from gen-class clause.
I mean:
(ns example.class
(:gen-class
:prefix pre-
:methods [[method_name1 [... arg types here ...]
Thaks for yor answer. It's really help me with studying.
--
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
Hi!
For example:
(ns exaple_class
(:gen-class))
(defn -main [args*] (...do smth...))
(defn -method_name1 [args*] (...do smth...))
(defn- -method_name2 [args*] (...do smth...))
(def -a 5)
(defn fun1 [args*] (...do smth...))
(defn- fun2 [args*] (...do smth...))
(def b 5)
As I understand, in t
Hi!
>>dotimes
>>macro
>>Usage: (dotimes bindings & body)
This is from clojure api.
But I don't know how to use dotimes with several bindings. I've tried
to do it different ways, but I got error every time.
So how to use dotimes with several bindings?
--
You received this message because you are
18 matches
Mail list logo