From: Christopher Lam <christopher.lck@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: patch to augment and=>
Date: Sun, 5 Jul 2020 09:47:06 +0000 [thread overview]
Message-ID: <CAKVAZZJDWRgOBDauto9wA7fcnmRWHpSsGKUMFo4+A=ZQ1SsrkQ@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 66 bytes --]
Hi guilers!
Is this of any interest to merge into boot.scm?
Chris
[-- Attachment #1.2: Type: text/html, Size: 122 bytes --]
[-- Attachment #2: and-arrow.patch --]
[-- Type: text/x-patch, Size: 691 bytes --]
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 0d37f3d48..edb7e93cc 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -803,9 +803,13 @@ VALUE."
(lambda _
value))
-(define (and=> value procedure)
- "When VALUE is #f, return #f. Otherwise, return (PROC VALUE)."
- (and value (procedure value)))
+(define (and=> value . procedures)
+ "When VALUE is #f, return #f. Otherwise, return (PROC VALUE). Recurse
+with subsequent procedures."
+ (if (null? procedures)
+ value
+ (let ((result ((car procedures) value)))
+ (and result (apply and=> result (cdr procedures))))))
(define call/cc call-with-current-continuation)
reply other threads:[~2020-07-05 9:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='CAKVAZZJDWRgOBDauto9wA7fcnmRWHpSsGKUMFo4+A=ZQ1SsrkQ@mail.gmail.com' \
--to=christopher.lck@gmail.com \
--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).