unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Xue Fuqiao <xfq.free@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: About Circular Objects
Date: Tue, 25 Dec 2012 16:52:27 +0200	[thread overview]
Message-ID: <87ip7q2nh0.fsf@mithlond.arda> (raw)
In-Reply-To: <20121225165249.e5822f6cc71fa88d959efcd0@gmail.com> (Xue Fuqiao's message of "Tue, 25 Dec 2012 16:52:49 +0800")

Xue Fuqiao [2012-12-25 16:52:49 +0800] wrote:

> I have a question about the #N# read syntax and #N= syntax. Look at
> this code:
>
> (progn
>   (setq x '#1=(a #1#))
>   (eq x (cdr x)))
>
> Why does this code return nil? Isn't the second element the list
> itself?

No. It's the CAR of the second cons cell that points to the list itself.
If you want the CDR of the first (and only) cons cell to point back to
the cons cell, you would use this:

    (progn
      (setq x '#1=(a . #1#)) ; Note the dotted list.
      (eq x (cdr x)))

    => t



  reply	other threads:[~2012-12-25 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-25  8:52 About Circular Objects Xue Fuqiao
2012-12-25 14:52 ` Teemu Likonen [this message]
     [not found] <mailman.16090.1356446630.855.help-gnu-emacs@gnu.org>
2012-12-25 14:48 ` Lars Magne Ingebrigtsen
2012-12-25 14:51 ` Pascal J. Bourguignon

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87ip7q2nh0.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=help-gnu-emacs@gnu.org \
    --cc=xfq.free@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).