help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: let-alist can't deal with the keys which includes spaces.


From: tomas
Subject: Re: let-alist can't deal with the keys which includes spaces.
Date: Wed, 21 Jul 2021 09:29:46 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Jul 20, 2021 at 08:17:32PM +0200, Emanuel Berg via Users list for the 
GNU Emacs text editor wrote:
> > The docstring is confusing IMO, your example so-so but
> > better because of the initial "`let-alist' is just a handy
> > way to destructure an alist" line, but why not just put it
> > like this?
> >
> > (setq numbers '((one   . 1)
> >                 (two   . 2)
> >                 (three . 3)
> >                 (four  . 4) ))
> >
> > (let-alist numbers
> >   (list .one .two .three .four) ) ; (1 2 3 4)
> 
> Or even better, because that's how it is supposed to be used,
> right, instead of `let' or as a variety thereof?
> 
>   (let-alist '((one   . 1)
>                (two   . 2)
>                (three . 3)
>                (four  . 4) )
>     (list .one .two .three .four) ) ; (1 2 3 4)

If the alist is constant anyway, I'd simply use `let'. I'd leave
`let-alist' for cases where the alist is somehow dynamically generated.

But perhaps that's just me :)

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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