If I remember correctly (I wasn't able to find the thread where this same
subject was explained), one must make a difference between functions
intended to work on data structures, and functions intended to work on
sequences.

Data structures are not volatile as sequences are, and those functions that
manipulate them generally take the data structure (vector, map, set, etc.)
as their first argument. It makes sense to create a partial function with
the data structure captured by the partial call.

Sequences are volatile, and thus less subject to be "captured" by a partial
call. And to enforce the difference between the 2, sequences are generally
the 2d or last argument to such functions.

HTH,

-- 
Laurent

2009/3/31 Nathan Sorenson <n...@sfu.ca>

>
> 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