|
From: Gustavo J. A. M. C. <gj...@in...> - 2007-06-13 09:50:14
|
On Qua, 2007-06-13 at 10:20 +0200, David Boucher wrote:
> Hi,
>
> We are near of a new release of NumExp. Not all is on the svn
> repository because of a last difficulty that should be fixed before
> this week end.
>
> This mail is just to have your idea on different things.
>
> The parser works now almost the same as Mathematica's one.
> The product doesn't need any * now. So, a b and a*b are equivalent.
> The grammar has no conflict but I had to change little things.
>
>
>
> 1. I come back on the functions' call.
>
> At the moment, if I enter x(2+x), it is understood as x*(2+x), also x
> (x+2) tells the same thing.
>
> Gustavo, you wanted that sin(x) is a function call. With the new
> parser, I can propose this :
>
> f(x) calls the function f with the argument x
>
> and f (x) is the product of f by x.
But, IMHO, a single space having such a big impact on the expression
is kind of dangerous.
I don't know if this is easy or not, but if I was designing the
language from scratch I'd make f(x) == f (x) == { f*x, if f is variable;
f[x] if f is function;}.
Of course that would imply overloading of variables and functions with
the same name would not be allowed anymore. And would imply that the
decision of whether to call function or multiply to be shifted from
parse time to eval time.
Anyway, just an idea; no idea if it is easy to implement, though.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
|