Diez B. Roggisch wrote:
>> This is already better. Is it possible to define function composition
>> as an operator and have something like ([EMAIL PROTECTED]@sorted)(items)
>> or (list*reversed*sorted)(items) ?
>
> Not on functions, but on classes/instances. So something like this might
> work for
Szabolcs <[EMAIL PROTECTED]> wrote:
> In Python this would be something like
> result = processData(list(reversed(sorted(data
I know that is only intended as an example, but by trying to use
Mathematica idioms in Python you are perhaps blinding yourself to using
Python's own idioms. A more
> This is already better. Is it possible to define function composition
> as an operator and have something like ([EMAIL PROTECTED]@sorted)(items)
> or (list*reversed*sorted)(items) ?
Not on functions, but on classes/instances. So something like this might
work for you (untested):
class FunctionC
Thanks for the reply!
On Apr 23, 10:55 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> > or define a
> > function composition operator for functions that take a single
> > argument?
>
> You could use this:
>
> def chain(*args):
>"""Compose functions (assoc right).
>last argument (args
En Mon, 23 Apr 2007 05:15:26 -0300, Szabolcs <[EMAIL PROTECTED]> escribió:
> Mathematica allows writing
> result = [EMAIL PROTECTED]@[EMAIL PROTECTED]
> or even
> result = data//Sort//Reverse//processData
> instead of
> result = processData[Reverse[Sort[data]]]
>
> In Python this would be somethin
I used Mathematica for data processing a lot and I got spoiled by its
functional programming possibilities.
I was drawn to Python because it also allows for a similar programming
style (and, more importantly, it has an interactive shell, ipython,
and a lot of libraries that are useful to me, like