GNU bug report logs -
#67456
[PATCH] seq.el: Add functions for mapping over subsequences
Previous Next
Reported by: Okamsn <okamsn <at> protonmail.com>
Date: Sun, 26 Nov 2023 17:19:01 UTC
Severity: wishlist
Tags: moreinfo, patch
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#67456: [PATCH] seq.el: Add functions for mapping over subsequences
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 67456 <at> debbugs.gnu.org.
--
67456: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67456
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Okamsn <okamsn <at> protonmail.com> writes:
> Stefan Kangas wrote:
>> Okamsn <okamsn <at> protonmail.com> writes:
>>
>>> Augusto Stoffel wrote:
>>>> This operation has quadratic complexity for anything other than regular
>>>> linked lists. I'm not sure it's a good idea to add it to a generic
>>>> sequence library...
>>>
>>>
>>> Thank you for the feedback.
>>>
>>> Do you know whether there is a better way to implement the idea for
>>> arrays? Is there a way to apply a function to a portion of the array
>>> without copying the sub-sequences, if that is what you mean?
>>
>> Hmm, it seems like this issue got stuck due to problems with algorithmic
>> complexity. Performance is a real issue in seq.el, so I think we should
>> solve that before we consider installing anything.
>>
>> Are you still working on this?
>
> I am no longer working on this. For some things, I opted to use the
> Stream package from ELPA, which now better supports arrays. Although it
> has the same problem when first traversing a seq.el sequence, it avoids
> recreating things for the sub-sequence.
>
> I am fine with this bug being closed.
Thanks, I guess that means that it's unlikely that we'll make more
progress here. I'm therefore closing this bug report.
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Hello,
The attached features work like `cl-maplist` and `cl-mapl`, applying
functions to a sequence and to the remaining parts of a sequence. For
example, `(seq-mapsub #'identity [1 2 3])` returns `([1 2 3] [2 3] [3])`.
The patch adds a `seq-mapsub`, `seq-dosub`, and a `seq-doseqsub`,
similar to `seq-map`, `seq-do`, and `seq-doseq`, respectively.
I was looking for an equivalent for vectors of `cl-maplist`, `cl-mapl`,
and `cl-loop`'s `for VAR on LIST`, and think that these would be useful
additions.
To get the sub-sequences, the code uses `seq-rest` and stops when the
returned sub-sequence is empty according to `seq-empty-p`. This is
similar to how I would do it for a list, using `cdr` and `null`, but is
that a good way to do it for arrays and other sequences?
Thank you.
[0001-Create-seq-functions-for-mapping-over-subsequences.patch (text/x-patch, attachment)]
This bug report was last modified 84 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.