emacs-diffs
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] map 6287979: Fix a false negative in `map-elt' with al


From: Nicolas Petton
Subject: Re: [Emacs-diffs] map 6287979: Fix a false negative in `map-elt' with alists and values being nil
Date: Sat, 25 Apr 2015 16:52:22 +0200

Artur Malabarba writes:

> Quick fix :-)
>
>> +(defun map--elt-list (map key &optional default)
>> +  "Return the element of the list MAP at the index KEY.
>> +If KEY is not found, return DEFAULT which defaults to nil."
>> +  (let ((pair (assoc key map)))
>> +    (if pair
>> +        (cdr (assoc key map))
>> +      default)))
>
> How about the following?
>
>  (if pair (cdr pair)
>    default)))

Thanks, I extracted `pair' and then forgot about it :)

Nico
-- 
Nicolas Petton
http://nicolas-petton.fr

Attachment: signature.asc
Description: PGP signature


reply via email to

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