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
>>
>> --
(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)?
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
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
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
(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
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
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