emacs-devel
[Top][All Lists]
Advanced

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

Re: The poor state of documentation of pcase like things.


From: Richard Copley
Subject: Re: The poor state of documentation of pcase like things.
Date: Sat, 2 Jan 2016 01:15:31 +0000

On 1 January 2016 at 18:39, David Kastrup <address@hidden> wrote:
> John Wiegley <address@hidden> writes:
>
>>>>>>> Eli Zaretskii <address@hidden> writes:
>>
>>>      (pcase skip
>>>        (`nil nil)
>>>        (`0 t)
>>>        (_ (setq i (+ i skip -1)) (funcall get-next-frame)))))))
>>
>> (cond ((null skip))
>>       ((eq skip 0) t)
>>       (t (setq i (+ i skip -1))
>>          (funcall get-next-frame)))
>>
>> Not much difference.
>
> If skip is nil, the first returns probably nil and the second t.  One
> could probably do
>
> (and skip
>      (or (eql skip 0)
>          (setq ...)))

True, but only an unintentional slip. I think the charitable interpretation is

(cond
  ((null skip) nil)
  [...])

> I'm not fond of eq for numeric comparisons: that's an Elispism.

That's Elisp programs for you. I'd have used zerop.



reply via email to

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