all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: John Mastro <john.b.mastro@gmail.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>,
	Nicolas Petton <nicolas@petton.fr>,
	Plamen Tanovski <pgt@arcor.de>
Subject: Re: seq-mapn and circular lists
Date: Thu, 15 Dec 2016 00:57:58 +0100	[thread overview]
Message-ID: <874m26gj21.fsf@web.de> (raw)
In-Reply-To: <CAOj2CQS=dLimPL30wFH0vM9NnSGs+JgE+HpF+nhFX5SwEE8f_g@mail.gmail.com> (John Mastro's message of "Wed, 14 Dec 2016 15:32:44 -0800")

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.



  reply	other threads:[~2016-12-14 23:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-12-15  9:26     ` Nicolas Petton
2016-12-15  9:33       ` Nicolas Petton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874m26gj21.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=john.b.mastro@gmail.com \
    --cc=nicolas@petton.fr \
    --cc=pgt@arcor.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.