William Stein wrote:

> That said, I could certainly see a place in sage for something
> like this:
>
>   sage: data = [-1, 2, 3]
>   sage: data = ma_eval('data /. x_?(# < 0 &) -> 0')
>   sage: data
>   [0, 2, 3]
>
> where ma_eval is a function that evaluates a mathematica-style
> expression in the scope of the current Sage
> session, and returns the result as a Python object.

The Mma operators /. #& -> etc are just doing things that might
just as well be represented as ordinary functions.
Wouldn't it be much clearer, and much less hackish, to just make
them functions and stay entirely within Python?
What's the benefit of parsing a string? Aside from the w00t-factor.

Incidentally Maxima has mostly the same set of expression-
mogrification
operators, expressed as function calls.

FWIW

Robert Dodier

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to