Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread Scott Jaderholm
ore))) > > > (->f m 2 2 1) > > Scott > > > > On Wed, Jun 29, 2011 at 7:00 PM, Antonio Recio wrote: >> Is there other way to express (((m2) 2) 1)? >> (def m [1 2 [21 22 [221 222 223] 23] 3]) >> (((m 2) 2) 1) >> ;-> 222 >> >> --

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread Scott Jaderholm
(defmacro ->f "like -> but f is threaded at pos 0 instead of 1" ([f] f) ([f x] `(~f ~x)) ([f x & more] `(->f (~f ~x) ~@more))) (->f m 2 2 1) Scott On Wed, Jun 29, 2011 at 7:00 PM, Antonio Recio wrote: > Is there other way to express (((m2) 2) 1)?

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread David Nolen
On Wed, Jun 29, 2011 at 8:54 PM, Dmitry Gutov wrote: > You can use 'reduce': > > (reduce nth m [2 2 1]) > ;; or, for the general case > (reduce #(%1 %2) m [2 2 1]) or (reduce get m [2 2 1]) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread Dmitry Gutov
You can use 'reduce': (reduce nth m [2 2 1]) ;; or, for the general case (reduce #(%1 %2) m [2 2 1]) On Jun 30, 3:20 am, Antonio Recio wrote: > (get-in m [2 2 1]) is great! Which are the others ones? Is there something > like (-> m [2 2 1])? -- You received this message because you are subscri

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread Tom Hicks
Sortof, but not as concisely, since the op is repeated each time: (-> m (nth 2) (nth 2) (nth 1)) -tom On Jun 29, 4:20 pm, Antonio Recio wrote: > (get-in m [2 2 1]) is great! Which are the others ones? Is there something > like (-> m [2 2 1])? -- You received this message because you are su

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread Antonio Recio
(get-in m [2 2 1]) is great! Which are the others ones? Is there something like (-> m [2 2 1])? -- 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 moderat

Re: Other way to express (((m2) 2) 1)?

2011-06-29 Thread David Nolen
On Wed, Jun 29, 2011 at 7:00 PM, Antonio Recio wrote: > (def m [1 2 [21 22 [221 222 223] 23] 3]) > (((m 2) 2) 1) > One my favorites. (get-in m [2 2 1]) David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clo

Other way to express (((m2) 2) 1)?

2011-06-29 Thread Antonio Recio
Is there other way to express (((m2) 2) 1)? (def m [1 2 [21 22 [221 222 223] 23] 3]) (((m 2) 2) 1) ;-> 222 -- 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 fro