Math expression applet
George Staikos
staikos at kde.org
Tue Apr 13 03:00:48 BST 2004
On Monday 12 April 2004 19:13, Andrew Coles wrote:
> I've had a quick look at the KST expression code and it has lead to a few
> ideas....
> - Perhaps the refactoring code could be reworked as a visitor to help
> abstract out how it is done from the implementation of the expression tree:
> this could also lead to further work in the refactoring direction (first
> idea: taking out common factors, e.g. x^3 - x^2 +1 -> x(x - 1) + 1) by
> just tweaking the visitor; also, another visitor could make an optimised
> stack-based evaluator for a specific function. If you like I'll look into
> this next week.
This was exactly what I had hoped to do. I just put in a
"proof-of-concept" with some of the easy things to start.
> - If we do come up with a nice, generalised, expression class it could be
> used in a souped-up kcalc as well: use the calculator normally; enter
> expressions; define reusable functions.... In fact, looking at the TODO,
> kcalc is down to get some extra modes (logic, stats) and this could
> no-doubt help, as well as make KCalc more versatile.
I think KCalc needs to stay as it is. There is always the possibility of
making a different style of calculator though.
> Arbitrary functions for Kexi shouldn't be too difficult: define a custom
> function node and pop it in the expression tree :)
Yup, that's already possible with what's in Kst too. If we get a need for
it, it's trivial to enable.
--
George Staikos
KDE Developer http://www.kde.org/
Staikos Computing Services Inc. http://www.staikos.net/
More information about the kde-core-devel
mailing list