On 2021-07-15 08:51 UTC, Lars Ingebrigtsen wrote: > Okam writes: > >> `map-let` allows one to conveniently bind variables using `map-elt`, but >> does not provide a way specify a default value if a key is missing. >> >> With `map-elt`, one can use the optional third argument to specify this >> value. It would be good to have this in `map-let` as well. >> >> For example, maybe it could look something like >> >> ;; As just a third value in the list: >> (let ((map '(:a 1 :b 2))) >> (map-let ((:a a) >> (:b b) >> (:c c 3)) >> map >> (+ a b c))) > > Hm... I guess that could be useful. I've added Nicolas to the CCs; > perhaps he has an opinion here. > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no Hello, I've written a patch and tests that would add an optional third argument for a default value. I also changed the documentation string for the pcase pattern, which said that unfound keys are ignored and won't cause the pattern to fail. That didn't seem true for patterns that didn't match nil. For example, this won't match: (pcase '(:two 2) ((map (:two two 33) (:three `(,a . ,b))) (list two a b)) (_ 'fail)) However, I have a question about avoiding using a lambda. I see that the pattern uses `pcase--flip`, which is "used internally to avoid (funcall (lambda ...) ...)". Why should lambda functions be avoided for this, and I should be using a custom helper function for this one pattern? Thank you.