Questions regarding do form

2012-09-27 Thread arekanderu
Hello all, I am new to clojure and I have two questions about do and the way it should be used. *Question 1: Which of the following two functions is more idiomatic and why? Both functions produce the same result.* code (defn my-fn [java-object] (. java-object firstFunc) (. java-object

Re: Questions regarding do form

2012-09-27 Thread arekanderu
Thank you Meikel for your so helpful replies. On Thursday, September 27, 2012 4:19:44 PM UTC+3, Meikel Brandmeyer (kotarak) wrote: Hi, Am Donnerstag, 27. September 2012 12:16:41 UTC+2 schrieb arekanderu: I am new to clojure and I have two questions about do and the way it should be used

Transforming an ugly nested loop into clojure code

2012-09-30 Thread arekanderu
Hello, I am trying to port an ugly piece of code from Ruby to clojure. So far I have only ported it to clojure by keeping the same way it was written in Ruby and i am trying to re-write it the clojure way because...wellits very ugly. I have a complex hash map which it's structure is always

Re: Transforming an ugly nested loop into clojure code

2012-09-30 Thread arekanderu
+3, Grant Rettke wrote: On Sun, Sep 30, 2012 at 2:59 PM, arekanderu areka...@gmail.comjavascript: wrote: I am trying to port an ugly piece of code from Ruby to clojure. May you share the original code? So far I have only ported it to clojure by keeping the same way it was written

Re: Transforming an ugly nested loop into clojure code

2012-10-01 Thread arekanderu
+3, arekanderu wrote: Thank you for your prompt reply Grant. * May you share the original code? * * * I will post the original function very soon* * * Why does my-map have vectors storing maps inside instead of a map with maps inside? * * * Because each vector will have more than one

Re: Transforming an ugly nested loop into clojure code

2012-10-01 Thread arekanderu
(:items box)] (do-something (:box box) (:item item))) (do-something-else (:warehouse warehouse) (:container container) (:box box) Might be more appropriate... On Mon, Oct 1, 2012 at 5:07 PM, arekanderu areka...@gmail.comjavascript

Re: Transforming an ugly nested loop into clojure code

2012-10-02 Thread arekanderu
Thank you for your input Stathis, I will have a look at them as well. On Sunday, September 30, 2012 10:59:05 PM UTC+3, arekanderu wrote: Hello, I am trying to port an ugly piece of code from Ruby to clojure. So far I have only ported it to clojure by keeping the same way it was written

Re: Clojure web framework

2012-10-03 Thread arekanderu
Hello, I had a similar question as the OP so I thought i should post it in this thread instead of starting a new one. I am trying to build a web services api which will only respond in json format. I had a look at everything suggested in this topic and I am leaning towards noir. Do you think

Re: Clojure web framework

2012-10-03 Thread arekanderu
, arekanderu areka...@gmail.comjavascript: wrote: Hello, I had a similar question as the OP so I thought i should post it in this thread instead of starting a new one. I am trying to build a web services api which will only respond in json format. I had a look at everything suggested

Noir.response and custom java object

2012-10-04 Thread arekanderu
Hello, I am not sure if i am supposed to ask a noir-related question in the group but the noir issues at github https://github.com/bitwalker/noir is closed so i thought someone here might know. I am trying to use a custom

Re: Noir.response and custom java object

2012-10-04 Thread arekanderu
: It seems to be using cheshire under the covers, did you add an encoder for your class? e.g: (add-encoder java.awt.Color (fn [c jsonGenerator] (.writeString jsonGenerator (str c On Thu, Oct 4, 2012 at 12:04 PM, arekanderu areka...@gmail.comjavascript: wrote: Hello

Re: Noir.response and custom java object

2012-10-04 Thread arekanderu
, October 4, 2012 8:32:25 PM UTC+3, arekanderu wrote: Hi Gaz That's exactly the part that I can't figure out. Where exactly am I supposed to do that? Inside the clj where I am going to use noir.response? My apologies if my question seems silly but I am a bit brain-blocked

Re: Noir.response and custom java object

2012-10-04 Thread arekanderu
UTC+3, arekanderu wrote: In fact, on the latest commit, response.cljhttps://github.com/bitwalker/noir/blob/master/src/noir/response.cljdoes not seem to use chesire.custom anymore even though this commithttps://github.com/bitwalker/noir/commit

Re: Noir.response and custom java object

2012-10-04 Thread arekanderu
After adding the dependencies of noir to my own project.clj, everything worked fine :) I hope that noir developers will make it a bit easier soon... On Thursday, October 4, 2012 9:26:56 PM UTC+3, arekanderu wrote: OK, the problem is that the custom encoders isn't merged with the master tree

Re: Is game development Clojure(functional in general) friendly?

2012-10-30 Thread arekanderu
I also happened to read an interesting articlehttp://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/recently about functional programming by John Carmack http://en.wikipedia.org/wiki/John_D._Carmack. On Tuesday, October 30, 2012 9:00:07 AM UTC+2, titon barua wrote: Hi, I am

Question about doseq

2012-10-30 Thread arekanderu
Hello all, I have the following code: (def my-hash {1 {:a-key {:value a value} :another-key another value :a-third-key []} 2 {:a-key {:value a value} :another-key another value :a-third-key []}} In the following example i get the following result: user= (doseq [[id