Closed rtoy closed 4 months ago
Imported from SourceForge on 2024-07-06 15:05:04 Created by willisbl on 2008-05-10 15:02:10 Original: https://sourceforge.net/p/maxima/bugs/1415/#b067
Logged In: YES user_id=895922 Originator: YES
Same bug, but different example:
OK
(%i2) %pi : 6; %pi improper value assignment to a numerical quantity -- an error. To debug this try debugmode(true);
Not OK
(%i8) (f() := %pi : 22/7, translate(f), f(), %pi); (%o8) 22/7 (%i9) %pi; (%o9) 22/7
Imported from SourceForge on 2024-07-06 15:05:08 Created by willisbl on 2008-05-10 15:02:11 Original: https://sourceforge.net/p/maxima/bugs/1415/#d4c8
Imported from SourceForge on 2024-07-06 15:05:12 Created by crategus on 2010-07-02 19:55:30 Original: https://sourceforge.net/p/maxima/bugs/1415/#c5eb
There is an interesting bug which is caused by the problem of this bug report. When we assign a value to a variable in a translated function we can not kill the value:
(%i1) f():= x:2$ (%i2) translate(f); (%o2) [f] (%i3) f(); (%o3) 2 (%i4) values; (%i5) kill(all); (%o0) done (%i1) functions; (%o1) []
The translated function has been killed. But the value of the variable is still present:
(%i2) x; (%o2) 2
We try it more explicitly:
(%i3) kill(x); remvalue: warning: cannot remove value of: x (%o3) done (%i4) x; (%o4) 2
I think we should add code to put a variable on the information list $values which gets a value in a translated function. This is the piece of code in the def%tr routine msetq in transl.lisp which does this:
`(progn (add2lnc ',var $values) (,(if *macexpr-top-level-form-p* 'defparameter 'setq) ,(teval var) ,val))))
With this change it is possible to remove the value of x too.
Furthermore, I think we should not extend the translated function to do a check for the assignment to a numerical constant. This test is done in the Maxima routine MSET, but it is the desired behavior to replace the overhead of a Maxima function.
Dieter Kaiser
Imported from SourceForge on 2024-07-06 15:05:03 Created by willisbl on 2008-05-10 12:50:07 Original: https://sourceforge.net/p/maxima/bugs/1415
Translated funtions do not append assignments to the values list.
This is OK:
(%i1) f() := x : 2$ (%i2) f(); (%o2) 2 (%i3) values; (%o3) [x]
This isn't OK
(%i4) g() := y : 2$ (%i5) translate(g)$ (%i6) g(); (%o6) 2 (%i7) values; (%o7) [x]
Let's look at $g:
(%i8) :lisp(function $g); (LAMBDA-BLOCK $G () NIL (SETQ $Y 2))