Re: [RFC] alist-let: let-like alist destructuring syntax
siiky 04 Jun 2022 11:31 UTC
Hi Wolfgang,
Thanks for your inputs!
> First of all, I think this might be form, but that it would be much
> more convenient if it could be parameterized on any dictionary type.
> This could be done through SRFI 225, or through a simple builder macro,
> e.g. something of the form
>
> (make-dict-binder binding-name dict-type-pred assoc-form),
>
> which would allow alist-let to be defined by
>
> (make-dict-binder alist-let list? alist-ref)
Yup, agree.
> True, but, since we're talking about O(n)-lookup alists, who
> cares about *this* inefficiency? Anyone using alists either
> (a) has ensured they're really short, or (b) doesn't care if
> they're slow, because they're writing a prototype or something
> quick and dirty.
>
> In any case, this is an alist-specific inefficiency. Other forms
> with asymptotically faster 'ref' procedures wouldn't have this
> issue, were alist-let generalized as I've suggested.
Forgot to mention it on the reply to Marc, but I also tend to agree with
this. If it can be made more performant, I'm all for it! But I don't
think it's worth trying to bend (the syntax) backwards for alists to be
more performant.
siiky