unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* ice-9/q.scm bug fix
@ 2003-12-31  1:36 Richard Todd
  2004-01-06 21:34 ` Kevin Ryde
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Todd @ 2003-12-31  1:36 UTC (permalink / raw)



[-- Attachment #1.1.1: Type: text/plain, Size: 522 bytes --]

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

[-- Attachment #1.1.2: q.scm.patch --]
[-- Type: text/plain, Size: 1046 bytes --]

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 <richardt@vzavenue.net>
+
+	* q.scm (q-pop!): Fixed lisp-ism where (not '()) was 
+	expected to return #t.
+
 2003-11-19  Neil Jerram  <neil@ossau.uklinux.net>
 
 	* 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 #1.2: Type: application/pgp-signature, Size: 186 bytes --]

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-guile

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-06 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-31  1:36 ice-9/q.scm bug fix Richard Todd
2004-01-06 21:34 ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).