<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 8.5.2015 8:19, Rustom Mody wrote:<br>
<blockquote
cite="mid:17583_1431062421_554C4795_17583_208_1_CAJ+Teoe1EBBKShc86TkhpCA3HPyKTTfrmh+0mgzEP7_vE5Bi2A@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, May 6, 2015 at 6:45 PM, Ivan
Levkivskyi <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:levkivskyi@gmail.com" target="_blank">levkivskyi@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>
<div style="overflow:auto">
<div class="gmail_signature"><br>
def sunique(lst):<br>
return sorted(list(set(lst)))<br>
<br>
vs. <br>
<br>
sunique = sorted @ list @ set<br>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
I would like to suggest that if composition is in fact
added to python its order is 'corrected'<br>
</div>
<div>ie in math there are two alternative definitions of
composition<br>
<br>
</div>
<div>[1] f o g = λ x • g(f(x))<br>
</div>
<div>[2] f o g = λ x • f(g(x))<br>
<br>
</div>
<div>[2] is more common but [1] is also used<br>
<br>
</div>
<div>And IMHO [1] is much better for left-to-right reading
so your example becomes<br>
</div>
<div>sunique = set @ list @ sorted<br>
</div>
<div>which reads as smoothly as a classic Unix pipeline:<br>
<br>
</div>
<div>"Unnamed parameter input to set; output inputted to
list; output inputted to sort"<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
<br>
</blockquote>
<br>
While both versions make sense, [2] is the one that resembles the
chaining of linear operators or matrices, since column vectors are
the convention. For the left-to-right pipeline version, some other
operator might be more appropriate. Also, it would then be more
clear to also feed x into the pipeline from the left, instead of
putting (x) on the right like in a normal function call.<br>
<br>
As a random example, (root @ mean @ square)(x) would produce the
right order for rms when using [2].<br>
<br>
-- Koos<br>
<br>
</body>
</html>