GNU bug report logs - #17662
24.3; Newly created variable has a value in it.

Previous Next

Package: emacs;

Reported by: James McClain <jamezmcclain <at> gmail.com>

Date: Sun, 1 Jun 2014 22:16:02 UTC

Severity: minor

Tags: notabug

Found in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17662 in the body.
You can then email your comments to 17662 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17662; Package emacs. (Sun, 01 Jun 2014 22:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to James McClain <jamezmcclain <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 01 Jun 2014 22:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: James McClain <jamezmcclain <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Newly created variable has a value in it.
Date: Sun, 1 Jun 2014 12:28:47 -0700
[Message part 1 (text/plain, inline)]
The variable "bins" has a value in it the second time the function is run.
It should be equal to ( () ).
I assume this has to do with me use of setcar.
(setq items '(1 3 4 5 3 2 9 8 5 10 2 3 1))
(defun greedy-binpacking (items size)
  (sort items '<)
  (let ((bins '( () ) ))
    (while items
      (let ((tmpbins bins)
    (item (pop items)))
 (while tmpbins
  (if (>= (+ (apply '+ (car tmpbins)) item) 10)
      (progn (setq tmpbins (cdr tmpbins))
     (unless tmpbins
       (setq bins
     (append bins `((,item))))
       (setq tmpbins '())))
    (setcar tmpbins
    (cons item (car tmpbins)))
    (setq tmpbins '())))))
    bins))
(greedy-binpacking items 10) --> ((3 2 2 1 1) (3 3) (5 4) (5) (8) (9) (10))
(greedy-binpacking items 10) --> ((3 2 2 1 1) (3 2 2 1 1) (3 3) (5 4) (5)
(8) (9) (10))
(greedy-binpacking items 10) --> ((3 2 2 1 1) (3 2 2 1 1) (3 3) (5 4) (5)
(8) (9) (10))
(greedy-binpacking items 10) --> ((3 2 2 1 1) (3 2 2 1 1) (3 3) (5 4)
(5) (8) (9) (10))



In GNU Emacs 24.3.1 (i386-mingw-nt6.2.9200)
 of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.2.9200
Configured using:
 `configure --with-gcc (4.7) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: ERC

Minor modes in effect:
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  show-paren-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n <return> C-s g a r b a <return> <return> SPC SPC
SPC SPC SPC SPC SPC SPC u u M-< C-s c o p y C-s C-s
C-s C-s C-a M-< C-s l i s t C-b <return> C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p
C-p C-p C-p <return> SPC SPC SPC SPC SPC SPC SPC <help-echo>
<help-echo> <down-mouse-1> <mouse-1> SPC SPC SPC C-p
SPC C-p 2 SPC SPC SPC SPC SPC SPC SPC SPC <help-echo>
<help-echo> <help-echo> <help-echo> <tab> C-g <help-echo>
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-l <help-echo> C-z C-x <return>
C-x b <return> C-x b <return> h e l l o SPC C-a C-k
I SPC b e l i e v e SPC I SPC f o u d <backspace> n
d SPC a SPC b u g SPC i n SPC m <backspace> e m a c
s <return> <help-echo> <help-echo> <down-mouse-1> <mouse-1>
C-y <return> C-x b <return> C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-x b <return> C-x b <return>
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
C-x b <return> y a <return> <help-echo> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <help-echo> M-x e m a c s <backspace> <backspace>
<backspace> <backspace> <backspace> b u g <tab> <tab>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> r e
p o <tab> <tab> r <tab> <return>

Recent messages:
Mark set
Mark saved where search started
Mark set
Mark saved where search started
user-error: No menu in this node
user-error: No cross references in this node
Quit
user-error: Point neither on reference nor in menu item description
Mark set
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail browse-url
macros edebug dabbrev gv debug face-remap pcmpl-unix erc-menu erc-join
erc-ring erc-networks erc-pcomplete erc-track erc-match erc-button
erc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat
format-spec thingatpt pp em-unix pcomplete em-term term ehelp electric
em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl
em-basic em-banner em-alias esh-var esh-io esh-cmd esh-opt esh-ext
esh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util
zenburn-theme cus-theme cus-edit cus-start cus-load wid-edit compile
comint ansi-color ring zenburn-theme-autoloads autoload help-fns
lisp-mnt help-mode misearch multi-isearch mule-util mail-utils
network-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045
ietf-drums url-gw url-cache url-auth url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse auth-source eieio byte-opt bytecomp byte-compile cconv
gnus-util mm-util mail-prsvr password-cache url-vars mailcap dired paren
undo-tree diff edmacro kmacro ido auctex-autoloads tex-site
clojure-cheatsheet-autoloads cider-autoloads clojure-mode-autoloads
dash-autoloads evil-autoloads geiser-autoloads info easymenu
goto-chg-autoloads helm-autoloads pkg-info-autoloads epl-autoloads
finder-inf undo-tree-autoloads package time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns
disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process w32 multi-tty emacs)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17662; Package emacs. (Sun, 01 Jun 2014 22:31:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: James McClain <jamezmcclain <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 24.3; Newly created variable has a value in it.
Date: Sun, 1 Jun 2014 15:10:01 -0700
[Message part 1 (text/plain, inline)]
Looking further into it, this seems to be proper (but still very strange)
behavior.

Info from the end of http://psg.com/~dlamkins/sl/chapter11.html.


On Sun, Jun 1, 2014 at 12:28 PM, James McClain <jamezmcclain <at> gmail.com>
wrote:

> The variable "bins" has a value in it the second time the function is run.
> It should be equal to ( () ).
> I assume this has to do with me use of setcar.
> (setq items '(1 3 4 5 3 2 9 8 5 10 2 3 1))
> (defun greedy-binpacking (items size)
>   (sort items '<)
>   (let ((bins '( () ) ))
>     (while items
>       (let ((tmpbins bins)
>     (item (pop items)))
>  (while tmpbins
>   (if (>= (+ (apply '+ (car tmpbins)) item) 10)
>       (progn (setq tmpbins (cdr tmpbins))
>      (unless tmpbins
>        (setq bins
>      (append bins `((,item))))
>        (setq tmpbins '())))
>     (setcar tmpbins
>     (cons item (car tmpbins)))
>     (setq tmpbins '())))))
>     bins))
> (greedy-binpacking items 10) --> ((3 2 2 1 1) (3 3) (5 4) (5) (8) (9) (10))
> (greedy-binpacking items 10) --> ((3 2 2 1 1) (3 2 2 1 1) (3 3) (5 4) (5)
> (8) (9) (10))
> (greedy-binpacking items 10) --> ((3 2 2 1 1) (3 2 2 1 1) (3 3) (5 4) (5)
> (8) (9) (10))
> (greedy-binpacking items 10) --> ((3 2 2 1 1) (3 2 2 1 1) (3 3) (5 4)
> (5) (8) (9) (10))
>
>
>
> In GNU Emacs 24.3.1 (i386-mingw-nt6.2.9200)
>  of 2013-03-17 on MARVIN
> Windowing system distributor `Microsoft Corp.', version 6.2.9200
> Configured using:
>  `configure --with-gcc (4.7) --cflags
>  -ID:/devel/emacs/libs/libXpm-3.5.8/include
>  -ID:/devel/emacs/libs/libXpm-3.5.8/src
>  -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
>  -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
>  -ID:/devel/emacs/libs/giflib-4.1.4-1/include
>  -ID:/devel/emacs/libs/jpeg-6b-4/include
>  -ID:/devel/emacs/libs/tiff-3.8.2-1/include
>  -ID:/devel/emacs/libs/gnutls-3.0.9/include
>  -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
>  -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
>
> Important settings:
>   value of $LANG: ENU
>   locale-coding-system: cp1252
>   default enable-multibyte-characters: t
>
> Major mode: ERC
>
> Minor modes in effect:
>   erc-list-mode: t
>   erc-menu-mode: t
>   erc-autojoin-mode: t
>   erc-ring-mode: t
>   erc-networks-mode: t
>   erc-pcomplete-mode: t
>   erc-track-mode: t
>   erc-track-minor-mode: t
>   erc-match-mode: t
>   erc-button-mode: t
>   erc-fill-mode: t
>   erc-stamp-mode: t
>    erc-netsplit-mode: t
>   erc-irccontrols-mode: t
>   erc-noncommands-mode: t
>   erc-move-to-prompt-mode: t
>   erc-readonly-mode: t
>   show-paren-mode: t
>   global-undo-tree-mode: t
>   undo-tree-mode: t
>   tooltip-mode: t
>   mouse-wheel-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent input:
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
> C-n <return> C-s g a r b a <return> <return> SPC SPC
> SPC SPC SPC SPC SPC SPC u u M-< C-s c o p y C-s C-s
> C-s C-s C-a M-< C-s l i s t C-b <return> C-n C-n C-n
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-p
> C-p C-p C-p <return> SPC SPC SPC SPC SPC SPC SPC <help-echo>
>  <help-echo> <down-mouse-1> <mouse-1> SPC SPC SPC C-p
> SPC C-p 2 SPC SPC SPC SPC SPC SPC SPC SPC <help-echo>
> <help-echo> <help-echo> <help-echo> <tab> C-g <help-echo>
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
> C-n C-n C-n C-n C-n C-n C-l <help-echo> C-z C-x <return>
> C-x b <return> C-x b <return> h e l l o SPC C-a C-k
> I SPC b e l i e v e SPC I SPC f o u d <backspace> n
> d SPC a SPC b u g SPC i n SPC m <backspace> e m a c
> s <return> <help-echo> <help-echo> <down-mouse-1> <mouse-1>
> C-y <return> C-x b <return> C-n C-n C-n C-n C-n C-n
> C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
> C-n C-n C-n C-n C-n C-n C-x b <return> C-x b <return>
> SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
> SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC
> C-x b <return> y a <return> <help-echo> <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <help-echo> M-x e m a c s <backspace> <backspace>
> <backspace> <backspace> <backspace> b u g <tab> <tab>
> <backspace> <backspace> <backspace> <backspace> <backspace>
> <backspace> <backspace> <backspace> <backspace> <backspace>
> <backspace> <backspace> <backspace> <backspace> r e
> p o <tab> <tab> r <tab> <return>
>
> Recent messages:
> Mark set
> Mark saved where search started
> Mark set
> Mark saved where search started
> user-error: No menu in this node
> user-error: No cross references in this node
> Quit
> user-error: Point neither on reference nor in menu item description
> Mark set
> Making completion list... [2 times]
>
> Load-path shadows:
> None found.
>
> Features:
> (shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
> mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail browse-url
> macros edebug dabbrev gv debug face-remap pcmpl-unix erc-menu erc-join
> erc-ring erc-networks erc-pcomplete erc-track erc-match erc-button
> erc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat
> format-spec thingatpt pp em-unix pcomplete em-term term ehelp electric
> em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl
> em-basic em-banner em-alias esh-var esh-io esh-cmd esh-opt esh-ext
> esh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-util
> zenburn-theme cus-theme cus-edit cus-start cus-load wid-edit compile
> comint ansi-color ring zenburn-theme-autoloads autoload help-fns
> lisp-mnt help-mode misearch multi-isearch mule-util mail-utils
> network-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045
> ietf-drums url-gw url-cache url-auth url url-proxy url-privacy
> url-expand url-methods url-history url-cookie url-domsuf url-util
> url-parse auth-source eieio byte-opt bytecomp byte-compile cconv
> gnus-util mm-util mail-prsvr password-cache url-vars mailcap dired paren
> undo-tree diff edmacro kmacro ido auctex-autoloads tex-site
> clojure-cheatsheet-autoloads cider-autoloads clojure-mode-autoloads
> dash-autoloads evil-autoloads geiser-autoloads info easymenu
> goto-chg-autoloads helm-autoloads pkg-info-autoloads epl-autoloads
> finder-inf undo-tree-autoloads package time-date tooltip ediff-hook
> vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns
> disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
> tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
> timer select scroll-bar mouse jit-lock font-lock syntax facemenu
> font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
> thai tai-viet lao korean japanese hebrew greek romanian slovak czech
> european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
> cus-face macroexp files text-properties overlay sha1 md5 base64 format
> env code-pages mule custom widget hashtable-print-readable backquote
> make-network-process w32 multi-tty emacs)
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17662; Package emacs. (Tue, 03 Jun 2014 04:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 17662 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: James McClain <jamezmcclain <at> gmail.com>
Cc: 17662 <at> debbugs.gnu.org
Subject: Re: bug#17662: 24.3; Newly created variable has a value in it.
Date: Tue, 03 Jun 2014 00:53:43 -0400
As you say, I don't think there is a bug here, just side-effects of
destructively modifying variables. So I'll close the report, but feel
free to keep discussing it if you wish. (The help-gnu-emacs mailing list
is a better place for these kind of questions though.)




bug closed, send any further explanations to 17662 <at> debbugs.gnu.org and James McClain <jamezmcclain <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 03 Jun 2014 04:54:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Jul 2014 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.