Re: special forms and let binding

2010-05-31 Thread Аркадий Рост
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

special forms

2010-05-19 Thread Аркадий Рост
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

Re: difference between if/when

2010-02-28 Thread Аркадий Рост
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

difference between if/when

2010-02-28 Thread Аркадий Рост
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

Re: commute misunderstanding

2010-02-19 Thread Аркадий Рост
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

Re: commute misunderstanding

2010-02-18 Thread Аркадий Рост
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

commute misunderstanding

2010-02-18 Thread Аркадий Рост
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

Re: how to use with-bindings*

2010-02-15 Thread Аркадий Рост
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

Re: how to use with-bindings*

2010-02-15 Thread Аркадий Рост
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

Re: how to use with-bindings*

2010-02-15 Thread Аркадий Рост
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

Re: how to use with-bindings*

2010-02-14 Thread Аркадий Рост
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

how to use with-bindings*

2010-02-14 Thread Аркадий Рост
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

Re: clojure gen-class questions

2010-02-10 Thread Аркадий Рост
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

Re: clojure gen-class questions

2010-02-09 Thread Аркадий Рост
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

Re: clojure gen-class questions

2010-02-09 Thread Аркадий Рост
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 ...]

Re: clojure gen-class questions

2010-02-09 Thread Аркадий Рост
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

clojure gen-class questions

2010-02-09 Thread Аркадий Рост
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

question about dotimes

2010-02-06 Thread Аркадий Рост
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