Hi,
I had to answer some of these questions when I wrote Lawvere: https://pypi.python.org/pypi/lawvere

First, there is two kind of composition: pipe and circle so I think a single operator like @ is a bit restrictive.
I like "->" and "<-"

Then, for function name and function to string I had to introduce function signature (a tuple).
It provides a good tool for decomposition, introspection and comparison in respect with mathematic definition.

Finally, for me composition make sense when you have typed functions otherwise it can easily become a mess and this make composition tied to multiple dispatch.

I really hope composition will be introduced in python but I can't see how it be made without rethinking a good part of function definition.

2015-05-09 17:38 GMT+02:00 Ron Adam :

On 05/09/2015 03:21 AM, Andrew Barnert via Python-ideas wrote:
>I suppose you could write (root @ mean @ (map square)) (xs),

Actually, you can't. You could write (root @ mean @ partial(map,
square))(xs), but that's pretty clearly less readable than
root(mean(map(square, xs))) or root(mean(x*x for x in xs). And that's
been my main argument: Without a full suite of higher-level operators
and related syntax, compose alone doesn't do you any good except for toy
examples.

How about an operator for partial?

root @ mean @ map \$ square(xs)

Actually I'd rather reuse the binary operators.  (I'd be happy if they were just methods on bytes objects BTW.)

compose(root, mean, map(square, xs))

root ^ mean ^ map & square (xs)

root ^ mean ^ map & square ^ xs ()

compose root, of mean, of map with square, of xs

Or...

apply(map(square, xs), mean, root)

map & square | mean | root (xs)

xs | map & square | mean | root ()

apply xs, to map with square, to mean, to root

These are kind of cool, but does it make python code easier to read?  That seems like it may be subjective depending on the amount of programming experience someone has.

Cheers,
Ron

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/