On Aug 30, 2008, at 4:46 PM, Robert Dodier wrote:
> Robert Bradshaw wrote:
>> On Fri, 29 Aug 2008, Jason Grout wrote:
>>> Jason Merrill wrote:
>
>>>> The Mathematica syntax is Hold[Integral[x,{x,0,1}]]. This remains
>>>> unevaluated until it is wrapped with an Evaluate[]. The nice thing
>>>> about this syntax is that it works for any kind of expression (not
>>>> just integrals).
>
>>> So maybe we could have something like a FormalExpression class
>>> whichdoes the same thing (has an argument that it doesn't evaluate).
>
>> Not sure how one would do this in Python though... (Maybe via
>> preparsing somehow, it would still be pretty hard...)
>
> From the direction this discussion has taken I'm guessing that
> nobody here is aware that selective evaluation is trivial in Lisp,
> and Maxima. In both cases a single quote marks stuff that
> isn't evaluated.
I actually did know that lisp has this feature. The real question is
how to expose such a feature in a natural way in the Sage (Python)
environment. Using Python has worked out very nice both for the UI
and core library--I don't see this changing anytime soon. And as
beautiful lisp is as a language, it seems even Maxima decided that it
wasn't suited for the front end of a CAS.
> Maxima further marks a distinction between
> so-called noun and verb operators; nouns are formal expressions
> and verbs are callable functions. E.g. integrate(...) is a function
> call and 'integrate(...) is a formal expression. I've omitted some
> details.
This is another good idea to consider, though there are some
drawbacks--it makes tab completion less convenient and in OO
programing the verb/noun distinction is often used to denote mutating/
return new object (though most of our objects are immutable).
This would be much easier to implement (in Python) than a generic
FormalExpression(2+2) that doesn't actually perform the addition.
Though slightly off topic, this is (IMHO) a much more interesting
question to think about. Python executes function arguments before
calling the function, which presents some difficulties. One thing we
could do is preparse this to FormalExpression("2+2") and use the
parser at http://hg.sagemath.org/sage-main/file/69d774a64568/sage/
misc/parser.pyx to get an expression tree. It would only handle a
subset of the Python language, but that's probably sufficient for
nearly all use cases and could be clearly documented. An
evaluate=False option for some things would give a non-preparsed way
of accessing this in some special cases.
> This kind of stuff yanks my chain in a bad way, unfortunately.
> I gather it is more interesting to reinvent the wheel than learn
> how to use existing, unfamiliar wheel technology.
To extend the analogy further, I think a significant portion of the
issue is that the wheel does not have the right hookups for the car,
and the amount of duct tape and hacks to get them working together
has become burdensome and inefficient. Also, Sage is not against
reinventing the wheel if nothing else out there meets our needs. That
being said, I think Maxima will remain a part of Sage for some time
to come, it just won't get fired up every time someone wants to
compute (sqrt(x)+1)^2.
> What makes
> it worse is that there is talk of copying Maple and Mathematica
> notation, which both have all sorts of warts. Blechh.
It's good to see how others do it for inspiration, but blindly
copying is bad. When warts are pointed out, hopefully we can come up
with something better.
> Oh gods, help me! I seem to be turning into RJF. Probably I
> should just butt out of this. It will make no difference to you
> and I will be happier in my ignorance.
No, your input is actually useful, and I don't have to put on a flame
suit every time I see your name. Please continue.
- Robert
> Robert "curmudgeon-in-training" Dodier
:)
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---