[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anaphoric macros like when-let
From: |
Matt Wette |
Subject: |
Re: Anaphoric macros like when-let |
Date: |
Sat, 26 Aug 2017 12:54:31 -0700 |
> On Aug 26, 2017, at 12:50 PM, Matt Wette <address@hidden> wrote:
>
>
>> On Aug 26, 2017, at 12:47 PM, Arun Isaac <address@hidden> 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))
(and-let* ((x (foo)))
(bar x))