Hi,
Disclaimer: personal opinion following...
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]"))
Maybe the (-> ...) part can be further extracted as `design-id` or so.
Class count 6 vs 2.
In mathematics f and f(x) are (in general) two different things. But
in programming 'x' is also information about the intended purpose. The
`part-numbers` argument of the anonymous function conveys some
information about what's supposed to be in there.
For last->: http://www.mail-archive.com/[email protected]/msg08098.html
(Can someone tell me why the search of ***Google*** groups is so
crappy?)
> Is there something wrong with (map #(s/split % #"\n" 30) vector-of-strs)?
>
> The #(...) lambda read-macro seems to me to obviate most needs for partial
> and partial-2.
+1
Also +1 for keeping the string argument first.
Sincerely
Meikel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---