emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 387e1e1: New version of `seq-let' based on a pc


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 387e1e1: New version of `seq-let' based on a pcase pattern
Date: Mon, 11 May 2015 11:06:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> Yes.  My idea of it was that you bind a sequence like the following:
>     (seq [a b [c d]])

I was thinking of (seq a b (seq c d)).

You could add support for (seq a b [c d]), if you want since that
currently wouldn't collide with any pcase pattern, tho I'm not sure it's
worth the added complexity for the user.

> But then how can I have `seq-let' work the way it did until now? For
> instance:
>     (seq-let [a [b [c]]] my-vector
>       ...)

You expand [a [b [c]]] to (seq a (seq b (seq c))) before passing it to
pcase-let.

>>> +           (push `(app (seq--reverse-args #'seq--nested-elt
>>> +                                          (reverse (cons ,index 
>>> ',nested-indexes)))
>>> +                       ,name)
>> This reverse plus seq--reverse-args business seems
>> hideously inefficient.  Why do you need that?
> because of the way the `app' pattern works.  Or maybe I'm missing
> something?

Why wouldn't

   `(app (seq--nested-elt ',(reverse (cons index nested-indexes))) ,name)

work as well?  Or, once you get rid of the nested case,

   `(app (seq-elt ,index) ,name)


-- Stefan



reply via email to

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