Re: macro that renames a function and records in a global list each non-local exit
Michel Talon <[email protected]> Fri, 5 Jun 2026 14:52:19 +0200
| Newsgroups | gmane.comp.mathematics.maxima.general |
|---|---|
| Message-ID | <[email protected]> |
Alternatively, if one uses sbcl one can use the trace facility to the same effect. Here is the documented feature: (describe 'trace) .... :REPORT Report-Type ... Otherwise, Report-Type is treated as a function designator and, for each trace event, funcalled with 5 arguments: trace depth (a non-negative integer), a function name or a function object, a keyword (:ENTER, :EXIT or :NON-LOCAL-EXIT), a stack frame, and a list of values (arguments or return values). As an example: (defun show (z1 z2 z3 z4 z5) (FORMAT t "~a ~a ~a ~a ~%" z1 z2 z3 z5)) (defun foo(x y) (* y x)) (trace foo :report show) (foo 3 2) yields 0 FOO ENTER (3 2) 0 FOO EXIT (6) 6 Clearly one can do whatever desired with z1--z5, in particular do something particular if z3 is :NON-LOCAL-EXIT as long as going to the non local exit occurs without falling in the debugger. This has the advantage that no modification is required to the original program. Le 03/06/2026 à 14:18, Barton Willis via Maxima-discuss a écrit : > Here is an AI‑assisted macro (with some push‑back from me along the > way) that renames a Common Lisp function and records information about > each non‑local exit in a global list: -- Michel Talon _______________________________________________ Maxima-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/maxima-discuss