|
From: | Dmitry Gutov |
Subject: | Re: What's missing in ELisp that makes people want to use cl-lib? |
Date: | Thu, 16 Nov 2023 17:42:52 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 16/11/2023 16:36, Augusto Stoffel wrote:
That breaks any sequence type based on lists. This is exactly the problem I was raising with too-many-generic interfaces, btw.Good point. IMO you just can't have both lists and "types based on lists" to work together properly; if we defined a method for seq-difference on lists, the issue would be the same (I guess that's the caveat you raised regarding Dmitri's patch).
Actually, we might not allow custom sequences based on lists to begin with. E.g. if there are two definitions
(cl-defmethod seq-length ((l (head :m6-sparse))) and (cl-defmethod seq-length ((l list))...is there a well-defined ordering between them which would determine the one that will be used for (cons :m6-sparse nil)?
If not, the optimization proposed by Augusto should be quite valid. And whatever custom sequences are added later, should use cl-defstruct or similar.
Try Dmitry's patch instead, the one containing seq-difference-3.That approach is fine, but it only addresses one function at a time. (If we go that way, I suggest starting by the most useful ones: seq-filter, seq-some and seq-reduce.)
My patch should help all the set operations (difference, union, intersection). And seq-uniq too.
Anyway, there is no reason not to use both optimizations together.
[Prev in Thread] | Current Thread | [Next in Thread] |