emacs-devel
[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: Artur Malabarba
Subject: Re: [Emacs-diffs] map 6287979: Fix a false negative in `map-elt' with alists and values being nil
Date: Sat, 25 Apr 2015 15:50:05 +0100

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)))



reply via email to

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