help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: seq-mapn and circular lists


From: Michael Heerdegen
Subject: Re: seq-mapn and circular lists
Date: Thu, 15 Dec 2016 00:57:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.90 (gnu/linux)

John Mastro <address@hidden> 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.



reply via email to

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