While looking through guile modules for my guile standard library
project, I came across a bug in (ice-9 q) which makes the queue
invalid if you pop all the entries off if it.

It appears to be a lisp-ism, where (not '()) was expected to return
#t, and of course in scheme it does not.

Attached, you should find a patch for this bug.

Example of the bug:

(use-modules (ice-9 q))
(define a (make-q))
(enq! a 3)
(deq! a)

;; at this point:
(q? a)   ==> #f ?!?
a        ==> (() 3)  ; should be (() #f)

thanks,
Richard Todd
Index: ice-9/ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/ice-9/ChangeLog,v
retrieving revision 1.597
diff -u -r1.597 ChangeLog
--- ice-9/ChangeLog     19 Nov 2003 01:16:16 -0000      1.597
+++ ice-9/ChangeLog     31 Dec 2003 01:16:04 -0000
@@ -1,3 +1,8 @@
+2003-12-30  Richard Todd <[EMAIL PROTECTED]>
+
+       * q.scm (q-pop!): Fixed lisp-ism where (not '()) was 
+       expected to return #t.
+
 2003-11-19  Neil Jerram  <[EMAIL PROTECTED]>
 
        * boot-9.scm (error-catching-loop): Defer lookup of
Index: ice-9/q.scm
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/ice-9/q.scm,v
retrieving revision 1.7
diff -u -r1.7 q.scm
--- ice-9/q.scm 5 Apr 2003 19:04:27 -0000       1.7
+++ ice-9/q.scm 31 Dec 2003 01:16:04 -0000
@@ -136,7 +136,7 @@
   (q-empty-check q)
   (let ((it (caar q))
        (next (cdar q)))
-    (if (not next)
+    (if (null? next)
        (set-cdr! q #f))
     (set-car! q next)
     it))

Attachment: pgp00000.pgp
Description: PGP signature

_______________________________________________
Bug-guile mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-guile

Reply via email to