rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

simplifya gives Lisp error for a cons #739

Closed rtoy closed 1 month ago

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-03 09:33:44 Created by crategus on 2010-03-03 22:46:58 Original: https://sourceforge.net/p/maxima/bugs/1914


I think simplifya has a small bug which should never be visible.

The routine simplifya checks for a cons of the form (a . b). If we have such a cons Maxima tries to throw a Maxima error. But this does not work, because merror can not handle a cons as a value to the argument list.

This is the piece of code in simplifya:

((atom (car x)) (cond ((and (cdr x) (atom (cdr x))) (merror "~%~S is a cons with an atomic cdr - `simplifya'" x)) ...

This is an example to generate the Maxima error, but we get a Lisp error

(%i1) :lisp (simplifya (list* 'fun 'x) nil) Maxima encountered a Lisp error:

The value FUN is not of type LIST.

Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil.

The reason is that merror can not handle the cons:

(%i1) :lisp (merror "~S" (list* 'fun 'x)) Maxima encountered a Lisp error:

The value FUN is not of type LIST.

Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil.

This would be the correct behaviour. I have removed the value from the call to merror:

(%i2) :lisp (simplifya (list* 'fun 'x) nil) Found a cons with an atomic cdr - `simplifya' -- an error. To debug this try: debugmode(true);

Dieter Kaiser

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-03 09:33:45 Created by crategus on 2010-03-07 21:06:27 Original: https://sourceforge.net/p/maxima/bugs/1914/#c809


rtoy commented 1 month ago

Imported from SourceForge on 2024-07-03 09:33:49 Created by crategus on 2010-03-07 21:06:27 Original: https://sourceforge.net/p/maxima/bugs/1914/#57eb


Fixed in simp.lisp revision 1.104. Closing this bug report as fixed. Dieter Kaiser