Conversation
6374091 to
3335de3
Compare
|
|
||
| def evaluate(self, evaluation) -> "Number": | ||
| """Evaluation of a Number is just itself""" | ||
| # Why bother checking timout? If there is one |
There was a problem hiding this comment.
Also: evaluating a number is (should be) instantaneous, so it is probably not the best place to evaluation.check_stoped.
|
@rocky this remembers me that Plus should be FinalForm (I don't remember the name), but its algorithm has a flaw that doesn't put terms together in just one evaluation. |
I don't understand exactly what you mean. Maybe though it would be better to open an issue and give a detailed example. |
3335de3 to
cb6bee9
Compare
Revise rewrite_apply_eval comment for threading.
cb6bee9 to
f754b46
Compare
I'll make a PR this weekend fixing this. In the Plus evaluation, we put together multiples of symbols (e.g.: y + 2y + x = 3y + x). But the Plus code put together just some variables, so something like this (but with way more terms) happen: Plus[a, b, c, a, b] -> Plus[2a, b, c, b] -> 2a + 2b + c |
Side Note: Tracing Add[1, 2] seems to do a lot of unnecessary data motion and conversion back and forth.
We convert to from a tuple to a list, evaluate elements that are already in their reduced form, try to flatten a flattened list convert that into a Mathics Sequence only to convert it back to something like what it was before.
The lack of comments/commentary about what is done and why and lack of modularity (which I really still don't know how to deal with) just is obscuring this convoluted process. Sure, in some cases it needs to be this complex. Just not all of the time.