unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Matt Wette <matt.wette@gmail.com>
To: Arun Isaac <arunisaac@systemreboot.net>
Cc: Guile User <guile-user@gnu.org>
Subject: Re: Anaphoric macros like when-let
Date: Sat, 26 Aug 2017 12:50:46 -0700	[thread overview]
Message-ID: <12D2B2C2-41A5-4F66-98DB-7F7A5AF0C819@gmail.com> (raw)
In-Reply-To: <1a0f67f3.AEAAO93SX5gAAAAAAAAAAAPWCvIAAAACwQwAAAAAAAW9WABZodBb@mailjet.com>


> On Aug 26, 2017, at 12:47 PM, Arun Isaac <arunisaac@systemreboot.net> wrote:
> 
> 
> Is there a Scheme or Guile equivalent to Emacs Lisp's `when-let' ?
> 
> Basically, I'm looking for a shorthand to express this:
> 
> (let ((x (foo))
>  (when x
>    (bar x))))
> 
> as this:
> 
> (when-let (x (foo))
>  (bar x))
> 

(use-modules (srfi srfi-2))

(and-let* ((x foo))
  (bar x))






  reply	other threads:[~2017-08-26 19:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-26 19:47 Anaphoric macros like when-let Arun Isaac
2017-08-26 19:50 ` Matt Wette [this message]
2017-08-26 19:54   ` Matt Wette
2017-08-27 12:28   ` Arun Isaac
2017-08-26 22:40 ` Kyle Siehl
2017-08-27 20:24 ` Mark H Weaver
2017-08-28  9:41   ` Arun Isaac

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=12D2B2C2-41A5-4F66-98DB-7F7A5AF0C819@gmail.com \
    --to=matt.wette@gmail.com \
    --cc=arunisaac@systemreboot.net \
    --cc=guile-user@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).