all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: Andreas Schwab <schwab@suse.de>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Customizing the VC backend order
Date: Sat, 11 Aug 2007 11:22:22 +0200	[thread overview]
Message-ID: <85lkcixw6p.fsf@lola.goethe.zz> (raw)
In-Reply-To: <jeodhel9lk.fsf@sykes.suse.de> (Andreas Schwab's message of "Sat\, 11 Aug 2007 11\:11\:03 +0200")

Andreas Schwab <schwab@suse.de> writes:

> dhruva <dhruvakm@gmail.com> writes:
>
>> Not so important/relavent: I went through the 'C' implementation of
>> 'nconc'. I find it concatenates 2'nd to the 1'st, 3'rd to the 2'nd...
>> N'th to the (N-1)'st and returns the 1'st list. I wonder how it can
>> get into an infinite loop.
>
> nconc can generate circular lists.

Which is what happens on the second iteration.  And on the third
iteration, nconc gets stuck trying to find the end of the circular
list in order to append to it.

nconc is _destructive_ on all but its last element.  So you need to
provide it with a list that you know you won't need later anymore.

You can write
(nconc (list 'Hg) something)
without any problem, since you generate a new list on any call.  And
you can even write verbatim
(nconc '(Hg) something)
as the reader generates a new list to nconc whenever it reads the
expression.  But as soon as you stick this into a loop or function or
anything else, the reader creates _one_ static list when he reads the
above expression.  And this list is _reused_ after it gets manipulated
with nconc.

Lisp is a dynamic language: all its programs are lists themselves, and
can be manipulated like lists.  And that is what you do here.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2007-08-11  9:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10  3:06 Customizing the VC backend order dhruva
2007-08-10  3:23 ` Stefan Monnier
2007-08-10  4:24   ` Stephen J. Turnbull
2007-08-10  4:33     ` Stefan Monnier
2007-08-10  5:07   ` dhruva
2007-08-10  5:24     ` Stefan Monnier
2007-08-10  5:44       ` dhruva
2007-08-10  5:53         ` Stefan Monnier
2007-08-11  5:04           ` dhruva
2007-08-11  9:11             ` Andreas Schwab
2007-08-11  9:22               ` David Kastrup [this message]
     [not found]                 ` <e3f230850708110327p285424cxd45f5393005a39bf@mail.gmail.com>
     [not found]                   ` <85ir7mwdkr.fsf@lola.goethe.zz>
     [not found]                     ` <e3f230850708110400v19e127c4i91f10f8e39934041@mail.gmail.com>
2007-08-11 12:05                       ` David Kastrup
2007-08-11 13:08                         ` dhruva
2007-08-10  5:32     ` David Kastrup
2007-08-10  5:44       ` David Kastrup
2007-08-10 14:59         ` Vinicius Jose Latorre
2007-08-10 17:40       ` Johan Bockgård

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=85lkcixw6p.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@suse.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.