|
From: Robert D. <rob...@gm...> - 2025-10-05 04:54:27
|
On Fri, Oct 3, 2025 at 9:41 PM Eduardo Ochs <edu...@gm...> wrote: > Now the real question. I would like to try to replace the Lisptree > functions that traverse Maxima objects/trees by other functions that > don't simplify subobjects/subtrees, and I am looking for _idiomatic_ > ways to do that in Lisp. I gather from the example that you gave, and looking at the implementation of Lisptree (https://anggtwu.net/lisptree.html), the problem is that Maxima is simplifying function call results in the Maxima code, lisptree.mac. I can think of a couple of ways to avoid that. One is to rewrite lisptree.mac in Lisp, so that the Maxima simplifier isn't called. I see that lisptree.mac is fairly extensive, so maybe that's easier said than done. The other is to disable the simplifier when you're extracting bits of expressions, e.g. block([simp: false], [myop, myargs]: [op (expr), args (expr)], ...). If you are only taking expressions apart, and not putting them together, there should be fewer surprising consequences of disabling the simplifier. > The real question is: does Maxima have an > utility function that receives a Maxima object and returns a version > of it "with a simp added if needed"? This is generally an approach that leads to ongoing headaches, since many functions will make assumptions about what they're working with if they see the SIMP flag. I don't usually say stuff like this but in this case -- my advice is just don't do that. FWIW. All the best, Robert |