bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66696: 29.1; "A bug in the function debug."


From: Gerd Möllmann
Subject: bug#66696: 29.1; "A bug in the function debug."
Date: Mon, 23 Oct 2023 08:57:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Lewis Creary via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> While I was trying to diagnose a bug in the function displayed just below
> with the help of the function debug, the interim values of the lisp variables 
> shown were inconsistent with the code being debugged.  For example,
> when called with the argument 5, the first element of the remainder list 
> should be 1 (5 divided by 2 leaves a remainder of 1).  However, the fn
> debug claims that the variable `rmdr-list' has the first element 0.  This is 
> just wrong!  And it has nothing to do with the problem being debugged.
>
> (defun dec-to-bin (n)
>   (let ((dividend n)
>         (rmdr-list nil)
>         (stop-sw nil)
>         (numstr "") )
>     (while ((and (>= dividend 0) (not stop-sw)))
>        (setq dividend (/ dividend 2)
>              rmdr-list (append (list (% dividend 2))                          
>                      rmdr-list) )
>        (if (= dividend 0)
>            (setq stop-sw t)) )

DId you get your parentheses right? The above ')' is the end of the while...

>        (debug) )
>     (while rmdr-list
>       (setq numstr (concat numstr (number-to-string                           
>                (car rmdr-list)))
>             rmdr-list (cdr rmdr-list) ) )
>     (string-to-number numstr) ))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]