* bug#17662: 24.3; Newly created variable has a value in it.
@ 2014-06-01 19:28 James McClain
2014-06-01 22:10 ` James McClain
0 siblings, 1 reply; 3+ messages in thread
From: James McClain @ 2014-06-01 19:28 UTC (permalink / raw)
To: 17662
[-- Attachment #1: Type: text/plain, Size: 6612 bytes --]
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)
[-- Attachment #2: Type: text/html, Size: 9619 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#17662: 24.3; Newly created variable has a value in it.
2014-06-01 19:28 bug#17662: 24.3; Newly created variable has a value in it James McClain
@ 2014-06-01 22:10 ` James McClain
2014-06-03 4:53 ` Glenn Morris
0 siblings, 1 reply; 3+ messages in thread
From: James McClain @ 2014-06-01 22:10 UTC (permalink / raw)
To: 17662
[-- Attachment #1: Type: text/plain, Size: 7176 bytes --]
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@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)
>
>
[-- Attachment #2: Type: text/html, Size: 10273 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#17662: 24.3; Newly created variable has a value in it.
2014-06-01 22:10 ` James McClain
@ 2014-06-03 4:53 ` Glenn Morris
0 siblings, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2014-06-03 4:53 UTC (permalink / raw)
To: James McClain; +Cc: 17662
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.)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-03 4:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-01 19:28 bug#17662: 24.3; Newly created variable has a value in it James McClain
2014-06-01 22:10 ` James McClain
2014-06-03 4:53 ` Glenn Morris
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.