From: Rob Browning <rlb@defaultvalue.org>
To: guile-devel@gnu.org
Subject: [PATCH 1/1] (scheme base) member: return #f, not (), for no match
Date: Sun, 4 Oct 2020 10:50:09 -0500 [thread overview]
Message-ID: <20201004155009.184217-1-rlb@defaultvalue.org> (raw)
* 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
next reply other threads:[~2020-10-04 15:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-04 15:50 Rob Browning [this message]
2020-10-04 16:55 ` [PATCH 1/1] (scheme base) member: return #f, not (), for no match Rob Browning
2020-10-04 18:59 ` Rob Browning
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201004155009.184217-1-rlb@defaultvalue.org \
--to=rlb@defaultvalue.org \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).