[Python-ideas] Function composition (was no subject)

Ron Adam ron3200 at gmail.com
Sun May 10 16:45:49 CEST 2015



On 05/10/2015 01:24 AM, Andrew Barnert via Python-ideas wrote:
> On May 9, 2015, at 20:08, Ron Adam <ron3200 at gmail.com> wrote:
>>
>>> On 05/09/2015 06:45 PM, Andrew Barnert via Python-ideas wrote:
>>>> On May 9, 2015, at 08:38, Ron Adam<ron3200 at gmail.com>  wrote:

>>> But, more importantly, this doesn't work. Your square(xs) isn't going
>>> to  evaluate to a function, but to a whatever falling square on xs returns.
>>> (Which is presumably a TypeError, or you wouldn't be looking to map in the
>>> first place). And, even if that did work, you're not actually composing a
>>> function here anyway; your @ is just a call operator, which we already have
>>> in Python, spelled with parens.
>>
>> This is following the patterns being discussed in the thread.  (or at least an attempt to do so.)
>>
>> The @ and $ above would bind more tightly than the ().  Like the doc "." does for method calls.
>
> @ can't bind more tightly than (). The operator already exists (that's
> the whole reason people are suggesting it for compose), and it has the same
> precedence as *.

Yes, and so it may need different symbols to work, but there are not many 
easy to type and read symbols left.  So some double symbols of some sort 
may work.

Picking what those should be is a topic all its own, and it's not even an 
issue until the concept works.

I should not even given examples earlier.  The point I was trying to make 
was an operator that indicates the next argument is not complete my be 
useful.  And I think the initial (or another) example implementation does 
do that, but uses a tuple to package the function with the partial 
arguments instead.

Cheers,
    Ron

























More information about the Python-ideas mailing list