[Maxima] gcl (lisp) break broken?

Raymond Toy toy.raymond at gmail.com
Fri Jul 27 11:39:31 CDT 2012


On Fri, Jul 27, 2012 at 9:23 AM, Edwin Woollett <woollett at charter.net>wrote:

> On July 12, 2012, Michel Talon wrote
> ------------------------------**------
>
>> If one chooses 0, the program crashes because fact(0) is not defined.  The
>> solution is simple replace the line with break by
>>
>> (cond ((zerop n) (break "N is zero.") 1)
>>
>> so that returning from break sets fact(0)=1, and then one gets (fact 5)
>> -> 120
>> choosing the restart 0 above.
>>
> ------------------------------**----------
> I tried your approach (although I realize it was not meant as a solution
> to my gcl problem) with the same lisp error and absence of a debugger
> prompt.
> ------------------------------**----------------------------
> (%i1) to_lisp();
> Type (to-maxima) to restart, ($quit) to quit Maxima.
>
> MAXIMA> 1
>
> 1
> MAXIMA> (defun fact (n)
>        (cond ((zerop n) (break "N is zero.") 1)
>              (t (* n (fact (- n 1))))))
>
> FACT
> MAXIMA> (fact 5)
>
> Maxima encountered a Lisp error:
>
> N is zero.
>
> Automatically continuing.
> To reenable the Lisp debugger set *debugger-hook* to nil.
>

If you want to see the lisp debugger, did you try what maxima suggested and
(setf *debugger-hook* nil)?

I notice, though, that I always run with maxima -g, and the lisp debugger
is enabled, but when I to to_lisp() and run fact as above, the lisp
debugger is disabled.  That seems not right.

Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120727/6c9d667c/attachment.html>


More information about the Maxima mailing list