Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread gvim
On 18/06/2014 17:07, Gary Trakhman wrote: Try http://clojuredocs.org/clojure_core/clojure.core/for I couldn't get anywhere near what was so easy in Ruby. Nested enumeration seems difficult in Clojure. gvim -- You received this message because you are subscribed to the Google Groups

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread Timothy Baldridge
Care to explain? How does it get much simpler than: (for [x some-collection y x z y] z) On Fri, Jun 20, 2014 at 5:52 AM, gvim gvi...@gmail.com wrote: On 18/06/2014 17:07, Gary Trakhman wrote: Try http://clojuredocs.org/clojure_core/clojure.core/for I couldn't get anywhere

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread gvim
On 20/06/2014 13:38, Timothy Baldridge wrote: Care to explain? How does it get much simpler than: (for [x some-collection y x z y] z) Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread François Rey
On 20/06/14 15:11, gvim wrote: Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't emulate Ruby's each_with_index, as in the example, as far as I'm aware. I'm fairly new to Clojure so the obvious may not be so

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread Dave Della Costa
Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to end up with. It's certainly possible to emulate the kind of nested loop structure you are asking about in Clojure, but most likely it's not how

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread Dave Della Costa
Sorry, the first example fn is confusing--I'd probably use assoc rather than update-in: (reduce #(assoc %1 %2 (do-aspected-stuff ...)) {} personals)) (2014/06/20 22:28), Dave Della Costa wrote: Rather than start with the code you are trying to duplicate, consider the data structure(s) that

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread gvim
On 20/06/2014 14:28, Dave Della Costa wrote: Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to end up with. It's certainly possible to emulate the kind of nested loop structure you are asking

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-20 Thread Gary Trakhman
I don't think you need plumbing for this. On Friday, June 20, 2014, gvim gvi...@gmail.com wrote: On 20/06/2014 14:28, Dave Della Costa wrote: Rather than start with the code you are trying to duplicate, consider the data structure(s) that you have as input and the data structure you want to

Clojure equivalent of 3-level enumeration in Ruby?

2014-06-18 Thread gvim
I have a method in Ruby that involves 3-level enumeration and would like to rewrite it in Clojure. Without asking anyone to do the job :), what is the best equivalent to this kind of Ruby iteration in Clojure? I looked at prewalk and postwalk but wasn't convinced that was what's required. Map

Re: Clojure equivalent of 3-level enumeration in Ruby?

2014-06-18 Thread Gary Trakhman
Try http://clojuredocs.org/clojure_core/clojure.core/for On Wed, Jun 18, 2014 at 11:56 AM, gvim gvi...@gmail.com wrote: I have a method in Ruby that involves 3-level enumeration and would like to rewrite it in Clojure. Without asking anyone to do the job :), what is the best equivalent to