Re: how to define a variable of type collection to keep other functions.

2014-05-28 Thread Carlo Zancanaro
On Wed, May 28, 2014 at 12:56:43AM -0700, sorin cristea wrote: > *( defn some-method[arg] (def thred (. Thread currentThred) > (println "on current thread" thread "use variable" arg))* > > 'thred' - is only visible inside of some-methd, because is a little > confuse for me your stateme

Re: how to define a variable of type collection to keep other functions.

2014-05-28 Thread sorin cristea
Thanks Sean, indeed this help me a lot .. one question, beside that it's not indicated to define def inside of a defn, as you pointed before, if I have the bellow code: *( defn some-method[arg] (def thred (. Thread currentThred) (println "on current thread" thread "use variable"

Re: how to define a variable of type collection to keep other functions.

2014-05-23 Thread Sean Corfield
On May 23, 2014, at 2:19 AM, sorin cristea wrote: > Thank Philippe for your advices,I came from java environment and seems I > still remain with some 'bad' habits. Coming from Java, the main thing to bear in mind in Clojure is that you do not have "variables" in the sense you are used to and yo

Re: how to define a variable of type collection to keep other functions.

2014-05-23 Thread sorin cristea
Thank Philippe for your advices,I came from java environment and seems I still remain with some 'bad' habits. On Friday, May 23, 2014 12:04:52 PM UTC+3, Philippe Guillebert wrote: > > Hello > > This is not written as functional code. You have to understand that : > > (cons f futures) > > cre

Re: how to define a variable of type collection to keep other functions.

2014-05-23 Thread Philippe Guillebert
Hello This is not written as functional code. You have to understand that : (cons f futures) creates a new "version" of futures with f in front of it and cons *returns it to you*. Put another way,* futures is not modified by cons*. In your dotimes construct, the consed value is lost each loo

how to define a variable of type collection to keep other functions.

2014-05-23 Thread sorin cristea
Hi all, do you have any idea how I can define a variable, global or inside a function, used to store for example the FutureTask objects resulted from ExecutorService submit(fn) call,I want to put all futures in a collection and later call 'get' on each of them. bellow is a sample of that code: