* seq-mapn and circular lists
@ 2016-12-14 22:19 Plamen Tanovski
2016-12-14 23:32 ` John Mastro
0 siblings, 1 reply; 5+ messages in thread
From: Plamen Tanovski @ 2016-12-14 22:19 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
while cl-map works fine on circular lists, seq-mapn just freezes
(let ((l1 '#1=(1 . #1#)))
; (map 'list #'+ '(3 4 5 7) l1)
(seq-mapn #'+ '(3 4 5 7) l1))
Making the circular list with setcdr or nconc doesn't help. Any
suggestions?
best regards
PT
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: seq-mapn and circular lists
2016-12-14 22:19 seq-mapn and circular lists Plamen Tanovski
@ 2016-12-14 23:32 ` John Mastro
2016-12-14 23:57 ` Michael Heerdegen
0 siblings, 1 reply; 5+ messages in thread
From: John Mastro @ 2016-12-14 23:32 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org; +Cc: Plamen Tanovski
Plamen Tanovski <pgt@arcor.de> wrote:
> Hi,
>
> while cl-map works fine on circular lists, seq-mapn just freezes
>
> (let ((l1 '#1=(1 . #1#)))
> ; (map 'list #'+ '(3 4 5 7) l1)
> (seq-mapn #'+ '(3 4 5 7) l1))
>
> Making the circular list with setcdr or nconc doesn't help. Any
> suggestions?
Indeed, seq-map and seq-mapn do not attempt to identify or handle circular
lists. My advice would be to avoid circular lists, or stick to `cl-map' if you
must accommodate them :)
Since seq.el is developed as part of Emacs, you can use `M-x report-emacs-bug'
to submit a feature request.
John
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: seq-mapn and circular lists
2016-12-14 23:32 ` John Mastro
@ 2016-12-14 23:57 ` Michael Heerdegen
2016-12-15 9:26 ` Nicolas Petton
0 siblings, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2016-12-14 23:57 UTC (permalink / raw)
To: John Mastro; +Cc: help-gnu-emacs@gnu.org, Nicolas Petton, Plamen Tanovski
John Mastro <john.b.mastro@gmail.com> writes:
[CC'ing the author of seq.el, Nicolas]
> > while cl-map works fine on circular lists, seq-mapn just freezes
> >
> > (let ((l1 '#1=(1 . #1#)))
> > ; (map 'list #'+ '(3 4 5 7) l1)
> > (seq-mapn #'+ '(3 4 5 7) l1))
> >
> > Making the circular list with setcdr or nconc doesn't help. Any
> > suggestions?
> Indeed, seq-map and seq-mapn do not attempt to identify or handle
> circular lists. My advice would be to avoid circular lists, or stick
> to `cl-map' if you must accommodate them :)
The problem seems to be that `seq-mapn' transforms every argument
sequence into a list before doing anything - but it doesn't check if
anything is already a list, so it effectively copies any list argument,
and this is what makes the thing freeze. If we avoid this copying, the
function would already do the right thing.
> Since seq.el is developed as part of Emacs, you can use `M-x
> report-emacs-bug' to submit a feature request.
Yes, please do that, Plamen.
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: seq-mapn and circular lists
2016-12-14 23:57 ` Michael Heerdegen
@ 2016-12-15 9:26 ` Nicolas Petton
2016-12-15 9:33 ` Nicolas Petton
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Petton @ 2016-12-15 9:26 UTC (permalink / raw)
To: Michael Heerdegen, John Mastro; +Cc: help-gnu-emacs@gnu.org, Plamen Tanovski
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
Michael Heerdegen <michael_heerdegen@web.de> writes:
Hi Michael,
>> Since seq.el is developed as part of Emacs, you can use `M-x
>> report-emacs-bug' to submit a feature request.
>
> Yes, please do that, Plamen.
I pushed a fix in master already :-)
Cheers,
Nico
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: seq-mapn and circular lists
2016-12-15 9:26 ` Nicolas Petton
@ 2016-12-15 9:33 ` Nicolas Petton
0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Petton @ 2016-12-15 9:33 UTC (permalink / raw)
To: Michael Heerdegen, John Mastro; +Cc: help-gnu-emacs@gnu.org, Plamen Tanovski
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
Nicolas Petton <nicolas@petton.fr> writes:
>>> Since seq.el is developed as part of Emacs, you can use `M-x
>>> report-emacs-bug' to submit a feature request.
>>
>> Yes, please do that, Plamen.
>
> I pushed a fix in master already :-)
And in ELPA.
Nico
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-15 9:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-14 22:19 seq-mapn and circular lists Plamen Tanovski
2016-12-14 23:32 ` John Mastro
2016-12-14 23:57 ` Michael Heerdegen
2016-12-15 9:26 ` Nicolas Petton
2016-12-15 9:33 ` Nicolas Petton
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.