I agree that forms like (partial > 3) are clearer than #() forms. However,
I've been avoiding partial in code bases for a while -- it was measurably
slower than the alternative. Is that still the case? Has anyone else
observed slowness with partial?
On Thursday, October 27, 2016 at 8:44:14 PM UTC-4, tbc++ wrote:
>
> I use comp all the time, not only for transducers, but also for digging
> into maps:
>
>
> (map (comp first :pets)
> [{:pets [:fluffy]}
> {:pets [:spot]}])
>
> => (:fluffy, :spot)
>
> Partial is also handy when used with a lot of sequence functions
>
> (->> [1 2 3 4 5]
> (filter (partial > 3)))
>
> Sure I could write that function as #(< 3 %), but I find that syntax
> harder to mentally parse as I have to remember that the body of the #() is
> a function context and then I have to look up where the % symbol is.
> (partial > 3) is just easier to understand.
>
> Timothy
>
>
>
> On Thu, Oct 27, 2016 at 6:12 PM, Mark Engelberg <[email protected]
> <javascript:>> wrote:
>
>> On Thu, Oct 27, 2016 at 9:39 AM, Alan Thompson <[email protected]
>> <javascript:>> wrote:
>>
>>> I almost never use either the `comp` or the `partial` functions. I
>>> think it is clearer to either compose the functions like Gary showed, or to
>>> use a threading macro (my favorite is the `it->` macro from the Tupelo
>>> library <https://github.com/cloojure/tupelo#literate-threading-macro>).
>>> Alan
>>>
>>>
>> You need to use comp if you're building a transducer.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]
>> <javascript:>
>> 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] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> “One of the main causes of the fall of the Roman Empire was that–lacking
> zero–they had no way to indicate successful termination of their C
> programs.”
> (Robert Firth)
>
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.