Re: Need help to translate a simple java program into Clojure program

2012-01-10 Thread Nicolas Garcin
Hi, Finally I managed to write my program, see below. It is probably not optimized at all (I had some issues with vector concatenation..) but at least it does the same as my java program. Thanks again! Regards, Nicolas (defrecord Pos [name value]   Object   (toString [this]         (str ""))) (d

Re: Need help to translate a simple java program into Clojure program

2012-01-10 Thread Nicolas Garcin
Thanks a lot to all of you. Regards, Nicolas On 10 jan, 08:14, Brian Mosley wrote: > Oops. > A possible solution might look something like that... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googleg

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Brian Mosley
Oops. A possible solution might look something like that... -- 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 fir

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Brian Mosley
(defrecord Pos [name value] Object (toString [this] (str ""))) (def actions [(Pos. "IBM", -50) (Pos. "ACCOR", -30); (Pos. "IBM", -10); (Pos. "APPLE", -20); (Pos. "AIRFRANCE", -20)]) (def options [(Pos. "IBM", 55) (Pos. "ACCOR", 40

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Sean Corfield
On Mon, Jan 9, 2012 at 1:56 PM, Linus Ericsson wrote: > the last one becomes something like this: > > (for [option modified-options action modified-actions] >    (if (= (:name option) (:name option)) >       (let [sum (+ (:value action) (:value option))] >          [{:name (:name option) (Math/max

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Baishampayan Ghose
On Tue, Jan 10, 2012 at 1:17 AM, Nicolas Garcin wrote: > I'm new to functional programming and Clojure and I'm trying to > translate a simple java program into Clojure. My program must build > from 2 input lists (stored in a vector) 2 output lists (also stored in > a vector) which have same number

Re: Need help to translate a simple java program into Clojure program

2012-01-09 Thread Linus Ericsson
2012/1/9 Nicolas Garcin > Hello, > > I'm new to functional programming and Clojure and I'm trying to > translate a simple java program into Clojure. My program must build > from 2 input lists (stored in a vector) 2 output lists (also stored in > a vector) which have same number of elements as inp

Need help to translate a simple java program into Clojure program

2012-01-09 Thread Nicolas Garcin
Hello, I'm new to functional programming and Clojure and I'm trying to translate a simple java program into Clojure. My program must build from 2 input lists (stored in a vector) 2 output lists (also stored in a vector) which have same number of elements as input lists for both output lists. The e