<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Many thanks,<br><br>&nbsp; This explanation and the example from Ref. manual 3.9.8 Immutable Cyclic Data makes everything clearer.<br><br>Example:<BR><table cellspacing="0"><tbody><tr><td><table class="RktBlk" cellspacing="0"><tbody><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/let.html#%28form._%28%28lib._racket/private/letstx-scheme..rkt%29._let*%29%29" class="RktStxLink">let*</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">ph</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._%7E23%7E25kernel%29._make-placeholder%29%29" class="RktValLink">make-placeholder</a></span><span class="hspace">&nbsp;</span><span class="RktVal">#f</span><span class="RktPn">)</span><span class="RktPn">]</span></td></tr><tr><td><span class="RktPlain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="RktPn">[</span><span class="RktSym">x</span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._%7E23%7E25kernel%29._cons%29%29" class="RktValLink">cons</a></span><span class="hspace">&nbsp;</span><span class="RktVal">1</span><span class="hspace">&nbsp;</span><span class="RktSym">ph</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPlain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._%7E23%7E25kernel%29._placeholder-set%21%29%29" class="RktValLink">placeholder-set!</a></span><span class="hspace">&nbsp;</span><span class="RktSym">ph</span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPlain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="http://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._%7E23%7E25kernel%29._make-reader-graph%29%29" class="RktValLink">make-reader-graph</a></span><span class="hspace">&nbsp;</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></tbody></table></td></tr><tr><td><span class="RktRes">#0=<span class="stt"> </span>'(1<span class="stt"> </span>. #0#)</span><BR></td></tr></tbody></table><br><br><div>&gt; Subject: Re: [racket] Reading graph structure<br>&gt; From: matthias@ccs.neu.edu<br>&gt; Date: Thu, 18 Aug 2011 10:32:21 -0400<br>&gt; CC: users@racket-lang.org<br>&gt; To: harryspier@hotmail.com<br>&gt; <br>&gt; <br>&gt; On Aug 18, 2011, at 10:21 AM, Harry Spier wrote:<br>&gt; <br>&gt; &gt; I've done that and what displays is:<br>&gt; &gt; #0=(1  . #0#)<br>&gt; &gt; #0='(1 . #0#)<br>&gt; &gt; <br>&gt; &gt; Again I'm not clear why this doesn't try to produce an endlessly recurring (1 . (1 . ( 1 .......  list<br>&gt; <br>&gt; At this point you're entering philosophical grounds: <br>&gt; <br>&gt;  is a cyclic list (ignoring how it is constructed) a good representation for the rational, infinite list of all 1s? <br>&gt; <br>&gt; As far as my practical programming issues are concerned, I am perfectly happy with it. <br>&gt; <br>&gt; Here is a snippet from a TicTacToe implementation that uses a cyclic list: <br>&gt; <br>&gt;  ;; the class of ttt buttons<br>&gt;   (define ttt% <br>&gt;     (shared ((turn (cons "U, Man" (cons "I, Bot" turn)))) <br>&gt;     ;; The above creates the 'infinite' list ("U, Man" . ("I, Bot" . ("U, Man" . ...)))<br>&gt;     ;; The first person on this list is the player whose turn it is. <br>&gt;     ;; You could create this list by reading the names off some input string. <br>&gt;       (class button% <br>&gt;         (field [status BLANK])<br>&gt;         ;; -&gt; String <br>&gt;         ;; what is its status? <br>&gt;         (define/public (is) status)<br>&gt;         ;; -&gt; Void (effect: this button is taken by the current player)<br>&gt;         (define/public (play)<br>&gt;           (define who (car turn))<br>&gt;           (when (and (send this is-enabled?) (string=? status BLANK))<br>&gt;             (set! status who)<br>&gt;             (send this set-label status)<br>&gt;             (send this enable #f)<br>&gt;             (when (N-in-a-row?)<br>&gt;               (disable-all)<br>&gt;               (send frame set-label (format "game's up: ~a won\n" who)))<br>&gt;             (set! turn (cdr turn))))<br>&gt;     ;; this last line uses the infinite list to switch turns <br>&gt; <br>&gt; <br></div>                                               </div></body>
</html>