On Sun, Nov 2, 2008 at 12:22 PM, John Cremona <[EMAIL PROTECTED]> wrote:
> How much of the problem would go away if the standard startup file had
> var('a b c d e f g h i j k l m n o p q r s t u v w x y z')
> in it? So that var() only had to be used explicitly for longer variable
> names?
>
> John
Anyway, in Sage, it seems reasonable to do this, right?
sage: f = x^2 + 1
sage: f
x^2 + 1
sage: f(3)
10
We actually used to do just what you suggest above (also with upper
case lttters).
It was amazing the amount of confusion and pain it caused, mainly
because one can call symbolic expressions. So people would do
this sort of thing
sage: f(10)
10
and be like WTF?! Because they thought they defined f somewhere
else to be some function, but that definition was in a previous session.
Incidentally, if we did allow automatic creation of symbolic
variables, and default
calling of symbolic expressions, then doing something like this would happen
all the time and confuse the crap out of people:
sage: function_name_with_slight_typo(10)
10
Obviously we would have to change Sage so that:
sage: f = x^2 + 1
sage: f(3)
boom -- big error
and require
sage: f(x=3)
10
I'm just pointing out one subtlety... which could be resolved.
I think it would be interesting to have at least the capability
of a mode where variable names are made symbolic if
not previously used, at least if the calling behavior were redefined
as above. This would have be done by somehow parsing the
input, finding all undefined variables, defining them, etc....
It's techincaly possible. Maybe Fernando Perez and I can
try to make a demo of something like this at Sage Days 11.
William
--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---