|
From: | James McClain |
Subject: | bug#17662: 24.3; Newly created variable has a value in it. |
Date: | Sun, 1 Jun 2014 15:10:01 -0700 |
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 MARVINWindowing system distributor `Microsoft Corp.', version 6.2.9200Configured 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: ENUlocale-coding-system: cp1252default enable-multibyte-characters: tMajor mode: ERCMinor modes in effect:erc-list-mode: terc-menu-mode: terc-autojoin-mode: terc-ring-mode: terc-networks-mode: terc-pcomplete-mode: terc-track-mode: terc-track-minor-mode: terc-match-mode: terc-button-mode: terc-fill-mode: terc-stamp-mode: terc-netsplit-mode: terc-irccontrols-mode: terc-noncommands-mode: terc-move-to-prompt-mode: terc-readonly-mode: tshow-paren-mode: tglobal-undo-tree-mode: tundo-tree-mode: ttooltip-mode: tmouse-wheel-mode: tmenu-bar-mode: tfile-name-shadow-mode: tglobal-font-lock-mode: tfont-lock-mode: tblink-cursor-mode: tauto-composition-mode: tauto-encryption-mode: tauto-compression-mode: tcolumn-number-mode: tline-number-mode: ttransient-mark-mode: tRecent 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-nC-n <return> C-s g a r b a <return> <return> SPC SPCSPC SPC SPC SPC SPC SPC u u M-< C-s c o p y C-s C-sC-s C-s C-a M-< C-s l i s t C-b <return> C-n C-n C-nC-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-pC-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-pSPC 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-nC-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-kI SPC b e l i e v e SPC I SPC f o u d <backspace> nd SPC a SPC b u g SPC i n SPC m <backspace> e m a cs <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-nC-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-nC-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 SPCSPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPC SPCC-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 ep o <tab> <tab> r <tab> <return>Recent messages:Mark setMark saved where search startedMark setMark saved where search starteduser-error: No menu in this nodeuser-error: No cross references in this nodeQuituser-error: Point neither on reference nor in menu item descriptionMark setMaking completion list... [2 times]Load-path shadows:None found.Features:(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decodemm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail browse-urlmacros edebug dabbrev gv debug face-remap pcmpl-unix erc-menu erc-joinerc-ring erc-networks erc-pcomplete erc-track erc-match erc-buttonerc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compatformat-spec thingatpt pp em-unix pcomplete em-term term ehelp electricem-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmplem-basic em-banner em-alias esh-var esh-io esh-cmd esh-opt esh-extesh-proc esh-arg eldoc esh-groups eshell esh-module esh-mode esh-utilzenburn-theme cus-theme cus-edit cus-start cus-load wid-edit compilecomint ansi-color ring zenburn-theme-autoloads autoload help-fnslisp-mnt help-mode misearch multi-isearch mule-util mail-utilsnetwork-stream starttls url-http tls mail-parse rfc2231 rfc2047 rfc2045ietf-drums url-gw url-cache url-auth url url-proxy url-privacyurl-expand url-methods url-history url-cookie url-domsuf url-utilurl-parse auth-source eieio byte-opt bytecomp byte-compile cconvgnus-util mm-util mail-prsvr password-cache url-vars mailcap dired parenundo-tree diff edmacro kmacro ido auctex-autoloads tex-siteclojure-cheatsheet-autoloads cider-autoloads clojure-mode-autoloadsdash-autoloads evil-autoloads geiser-autoloads info easymenugoto-chg-autoloads helm-autoloads pkg-info-autoloads epl-autoloadsfinder-inf undo-tree-autoloads package time-date tooltip ediff-hookvc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fnsdisp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringetabulated-list newcomment lisp-mode register page menu-bar rfn-eshadowtimer select scroll-bar mouse jit-lock font-lock syntax facemenufont-core frame cham georgian utf-8-lang misc-lang vietnamese tibetanthai tai-viet lao korean japanese hebrew greek romanian slovak czecheuropean ethiopic indian cyrillic chinese case-table epa-hookjka-cmpr-hook help simple abbrev minibuffer loaddefs button facescus-face macroexp files text-properties overlay sha1 md5 base64 formatenv code-pages mule custom widget hashtable-print-readable backquotemake-network-process w32 multi-tty emacs)
[Prev in Thread] | Current Thread | [Next in Thread] |