Hi Nathan,
There is actually a simple answer to your question. map can take a
fuction of multiple parameters along with multiple collections. i.e.

(defn f [x y] (+ x y))

(map f [1 2] [3 4])
=> (4 6)

(Warning I did this computation in the Clojure instance in my head, so
some details may be slightly off.)

Paul

On 3/31/09, Nathan Sorenson <n...@sfu.ca> wrote:
>
> First of all, I would like to thank Rich and this community for
> producing such a pleasurable language, and for putting up with with
> all the unpleasant nit-picking of new users. That being said...
>
> I am curious as to why the function parameter is specified before the
> collection parameter in map/reduce. I have never used a lisp before,
> and may not be aware of idiomatic style, but it seems to be the
> convention elsewhere in Clojure (assoc, conj, .method calls, etc...)
> to have the "altered" data structure be the first parameter.
>
> Would this not allow mixing map into a threaded expression:
>
> (-> [1 2 3]
>  (map inc)
>  (assoc 0 4)
>  (reduce +)
>  (conj :anotherthing))
>
> Perhaps this style is rare in practice? Certainly it is easy enough to
> write a custom map/reduce which acts this way, so I suppose my
> question is mostly philosophical.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to