* Re: map 6287979: Fix a false negative in `map-elt' with alists and values being nil
[not found] ` <E1Ylwzr-0005nr-SF@vcs.savannah.gnu.org>
@ 2015-04-25 14:50 ` Artur Malabarba
2015-04-25 14:52 ` Nicolas Petton
0 siblings, 1 reply; 2+ messages in thread
From: Artur Malabarba @ 2015-04-25 14:50 UTC (permalink / raw)
To: emacs-devel, Nicolas Petton; +Cc: emacs-diffs
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)))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: map 6287979: Fix a false negative in `map-elt' with alists and values being nil
2015-04-25 14:50 ` map 6287979: Fix a false negative in `map-elt' with alists and values being nil Artur Malabarba
@ 2015-04-25 14:52 ` Nicolas Petton
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Petton @ 2015-04-25 14:52 UTC (permalink / raw)
To: bruce.connor.am; +Cc: emacs-diffs, emacs-devel
[-- Attachment #1.1: Type: text/plain, Size: 529 bytes --]
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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-25 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20150425100739.22272.85986@vcs.savannah.gnu.org>
[not found] ` <E1Ylwzr-0005nr-SF@vcs.savannah.gnu.org>
2015-04-25 14:50 ` map 6287979: Fix a false negative in `map-elt' with alists and values being nil Artur Malabarba
2015-04-25 14:52 ` Nicolas Petton
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.