On Aug 20, 2009, at 2:29 AM, Meikel Brandmeyer wrote:

> Hi,
>
> Disclaimer: personal opinion following...

I think that's all we have when it comes to matters of style :-)

> I'm sorry. I don't get the elegance of point-free style.
>
> In mathematics f denotes the function, while f(x) denotes the value f
> takes over x. This is actually a nice and easy to understand notation.
> But why do I have to clutter my clojure code with `partial`s and
> `comp`s because of that? In Haskell, where `partial` is automatic and
> `comp` is a dot, this is maybe elegant. But not here.
>
> I don't know, whether this example is contorted on purpose, but I
> really had to very slowly step through it to see what's going on.
>
>> (map (comp (partial map (comp   #(str2/drop % 2)
>>                               #(str2/take % 5)))
>>               #(str2/split % #"\t"))
>>       (split a-string #"[\n\r]"))
>
> This is almost self-explaining:
>
> (map (fn [part-numbers]
>       (map #(-> % (str2/take 5) (str2/drop 2))
>            (str2/split part-numbers #"\t")))
>     (str2/split a-string #"[\n\r]"))

I agree wholeheartedly with Meikel. -> is very straightforward for me  
to understand.

Outside of matters of style, changing the expected arguments of ->  
would make at least two things impossible:

- use of variadic fns, e.g. (-> data (my-fn arg1 arg2 ... argN) keys  
last)

- use of host platform fns (this is incredibly useful with  
ByteBuffers, etc) (-> bytebuffer (.put other-data) .flip (.position  
23) (.limit 89))

Back to matters of style, and agreeing with Jon upthread, doesn't #()  
provide a superset of partial's functionality, with more 'literal',  
easier-to-read code?

Cheers,

- Chas

--~--~---------~--~----~------------~-------~--~----~
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 moderated - please be patient with your 
first post.
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