unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH 1/1] (scheme base) member: return #f, not (), for no match
@ 2020-10-04 15:50 Rob Browning
  2020-10-04 16:55 ` Rob Browning
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Browning @ 2020-10-04 15:50 UTC (permalink / raw)
  To: guile-devel

* module/scheme/base.scm (member): Match the r7rs requirement, as assoc
  already does.

Thanks to Erik Dominikus for reporting the problem.

Closes: 43304
---

 Proposed for 3.0

 module/scheme/base.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/module/scheme/base.scm b/module/scheme/base.scm
index 5a366f846..94591477d 100644
--- a/module/scheme/base.scm
+++ b/module/scheme/base.scm
@@ -129,9 +129,10 @@
     (unless (procedure? =)
       (error "not a procedure" =))
     (let lp ((ls ls))
-      (if (or (null? ls) (= (car ls) x))
-          ls
-          (lp (cdr ls)))))))
+      (cond
+       ((null? ls) #f)
+       ((= (car ls) x) ls)
+       (else (lp (cdr ls))))))))
 
 (define* (assoc x ls #:optional (= equal?))
   (cond
-- 
2.26.1




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

* Re: [PATCH 1/1] (scheme base) member: return #f, not (), for no match
  2020-10-04 15:50 [PATCH 1/1] (scheme base) member: return #f, not (), for no match Rob Browning
@ 2020-10-04 16:55 ` Rob Browning
  2020-10-04 18:59   ` Rob Browning
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Browning @ 2020-10-04 16:55 UTC (permalink / raw)
  To: guile-devel

Rob Browning <rlb@defaultvalue.org> writes:

> * module/scheme/base.scm (member): Match the r7rs requirement, as assoc
>   already does.
>
> Thanks to Erik Dominikus for reporting the problem.
>
> Closes: 43304
> ---
>
>  Proposed for 3.0

Hmm, this causes a failure in r7rs.test.  Not sure if I made a mistake,
or if other code depends on the incorrect behavior.  Looking in to it.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



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

* Re: [PATCH 1/1] (scheme base) member: return #f, not (), for no match
  2020-10-04 16:55 ` Rob Browning
@ 2020-10-04 18:59   ` Rob Browning
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Browning @ 2020-10-04 18:59 UTC (permalink / raw)
  To: guile-devel

Rob Browning <rlb@defaultvalue.org> writes:

> Hmm, this causes a failure in r7rs.test.  Not sure if I made a mistake,
> or if other code depends on the incorrect behavior.  Looking in to it.

Ahh, it just revealed a bug in r7rs.test, i.e.:

diff --git a/test-suite/tests/r7rs.test b/test-suite/tests/r7rs.test
index 0914f0c5e..1cc8cd31e 100644
--- a/test-suite/tests/r7rs.test
+++ b/test-suite/tests/r7rs.test
@@ -2171,7 +2171,7 @@
        (let ((out (open-output-string))
              (x (list 1)))
          (set-cdr! x x)
-         (write x out)
+         (write-shared x out)
          (get-output-string out))
        ;; labels not guaranteed to be 0 indexed, spacing may differ
        '("#0=(1 . #0#)" "#1=(1 . #1#)"))

I'll add that to the commit.

-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



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

end of thread, other threads:[~2020-10-04 18:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 15:50 [PATCH 1/1] (scheme base) member: return #f, not (), for no match Rob Browning
2020-10-04 16:55 ` Rob Browning
2020-10-04 18:59   ` Rob Browning

unofficial mirror of guile-devel@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-devel/0 guile-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-devel guile-devel/ https://yhetil.org/guile-devel \
		guile-devel@gnu.org
	public-inbox-index guile-devel

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.devel
	nntp://news.gmane.io/gmane.lisp.guile.devel


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git