LOOP counts symbols in COMMON-LISP wrong

Bug #1865234 reported by Dima Akater
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
Undecided
Unassigned

Bug Description

LOOP counts symbols in package COMMON-LISP wrong.

Below is a transcript of example session, following the bug reporting guidelines. I noticed this a couple of years back. I could not reproduce the bug for packages other than COMMON-LISP.

~ $ uname -a
Linux poseidon.akater 4.19.97-gentoo-poseidon #1 SMP Wed Jan 22 13:34:43 UTC 2020 x86_64 Intel(R) Core(TM)2 Duo CPU L9400 @ 1.86GHz GenuineIntel GNU/Linux

~ $ sbcl --version
SBCL 2.0.1

~ $ rlwrap sbcl
This is SBCL 2.0.1, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.

* *features*
(:ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-UNIX
 :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :X86-64 :64-BIT :ANSI-CL :COMMON-LISP
 :ELF :GENCGC :IEEE-FLOATING-POINT :LINUX :LITTLE-ENDIAN
 :PACKAGE-LOCAL-NICKNAMES :SB-CORE-COMPRESSION :SB-LDB :SB-PACKAGE-LOCKS
 :SB-THREAD :SB-UNICODE :SBCL :UNIX)

* (let ((count 0)) (do-symbols (_ (find-package :cl) count) (declare (ignore _)) (incf count)))
978
* (let ((count 0)) (loop for s being each symbol of (find-package :cl) do (incf count)) count)
978
;; for good measure
* (push #P"/home/akater/quicklisp/dists/quicklisp/software/series-20131111-git/" asdf:*central-registry*)
  (asdf:load-system :series)
* (series:collect-length (series:scan-symbols (find-package :cl)))
978
;; and yet
* (loop for s being each symbol of (find-package :cl) count s)
977

Dima Akater (akater)
description: updated
Revision history for this message
Douglas Katzman (dougk) wrote :

http://www.lispworks.com/documentation/HyperSpec/Body/06_ac.htm

"The count construct counts the number of times that the supplied form returns true."

(loop for x in '(nil) count x) => 0

Changed in sbcl:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.