GNU bug report logs - #67456
[PATCH] seq.el: Add functions for mapping over subsequences

Previous Next

Package: emacs;

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

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#67456: closed ([PATCH] seq.el: Add functions for mapping over
 subsequences)
Date: Tue, 25 Feb 2025 02:40:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 24 Feb 2025 20:39:31 -0600
with message-id <CADwFkm=x5d2NS5B_cYX_yqSznF=wQ5J8jwfT_E6adEA_E-g8KQ <at> mail.gmail.com>
and subject line Re: bug#67456: [PATCH] seq.el: Add functions for mapping over subsequences
has caused the debbugs.gnu.org bug report #67456,
regarding [PATCH] seq.el: Add functions for mapping over subsequences
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> 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)]
From: Okamsn <okamsn <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org, Nicolas Petton <nicolas <at> petton.fr>
Subject: [PATCH] seq.el: Add functions for mapping over subsequences
Date: Sun, 26 Nov 2023 17:17:35 +0000
[Message part 3 (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)]
[Message part 5 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Okamsn <okamsn <at> protonmail.com>
Cc: nicolas <at> petton.fr, arstoffel <at> gmail.com, 67456-done <at> debbugs.gnu.org
Subject: Re: bug#67456: [PATCH] seq.el: Add functions for mapping over
 subsequences
Date: Mon, 24 Feb 2025 20:39:31 -0600
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.


This bug report was last modified 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.