Re: Books for learning Clojure

2014-04-22 Thread Alex Vzorov
I started with JoC and reading Programming Clojure now. Both give pretty good introduction to the language and its capabilities. JoC is full of not-so-simple examples, but they make one's brain work, show the clojure way, and are good for people how know they way around programming in general.

Re: How to work with variables that need to change

2014-04-15 Thread Alex Vzorov
Hi, Cecil. The difference is that doseq is used to produce side-effects, which is idiomatic, which is exactly what you did. When using doseq you can be sure that it's body will evaluate, whereas with map, for, reduce you can't - they expect pure functions, and produce lazy sequences, and there

Re: Is it possible to give an atomic message?

2014-04-11 Thread Alex Vzorov
You could use a clojure agent , that would output your messages on a separate thread, one by one. (def *logger* (agent 0)) (defn give-message [message] (send *logger* (fn [_ & [msg]] (println (format "%s: %s" (. time-format format (. (now) getTime)) msg)))