help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quick pcase question


From: Eric Abrahamsen
Subject: Re: Quick pcase question
Date: Thu, 03 Mar 2016 09:08:25 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

phillip.lord@russet.org.uk (Phillip Lord) writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Michael Heerdegen <michael_heerdegen@web.de> writes:
>>
>>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>>
>>>> (pcase tst
>>>>   (`(symbolla . ,(and x (pred stringp)))
>>>>    (message "cdr is a string: %s" x)))
>>>>
>>>> Is the ",(and x (pred stringp))" part really the simplest way of doing
>>>> that?
>>>
>>> Yes, I think so.
>>>
>>> How could it be much simpler (there is not much redundancy in that
>>> expression)?
>>
>> It's not so much the simplicity, I guess, as the intuitiveness -- "(and x"
>> looks like a test to me, not an assignment. My brain would prefer:
>>
>> (,x (pred stringp))
>
> What about?
>
> (guard (stringp ,x))

You're suggesting that as a possible alternate syntax, right? (In which
case I like it.) It doesn't actually work now, does it?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]