<br><div class="gmail_quote">On Tue, Nov 16, 2010 at 4:58 AM, Peter Breitsprecher <span dir="ltr">&lt;<a href="mailto:pkbreits@lakeheadu.ca">pkbreits@lakeheadu.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I know I am missing something small, but I made that change, and it is terminating too soon, and not quite working correctly.  The nested list works fine, but the outer list isn&#39;t correct.  <br>Example.  <br>I give it input of &#39;(3 (4 5) 6))<br>

and it returns <br>(((4 5) 3))<br><br>Which means it is terminating too soon, and it is reversing the inner list properly, but not the outer list after it completes that inner recursion.</blockquote><div><br></div><div>Yes - as stated previously, you&#39;ll need to pass in the results from (cons (read-list-helper &#39;()) list-so-far) back to the helper in order not to terminate early, and you should also check for the end of the file as well. </div>
<div><br></div><div>Cheers,</div><div>yc</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5"><br><div class="gmail_quote">On 15 November 2010 21:13, YC <span dir="ltr">&lt;<a href="mailto:yinso.chen@gmail.com" target="_blank">yinso.chen@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div class="gmail_quote"><div><div><br></div>



</div><div>Correct - that&#39;s the idea for reading in a nested list, unless you were trying to flatten the list as you read them. </div><div><br></div><div>The (cons (read-list-helper &#39;() list-so-far) should also be passed again to your helper proc, or it terminates prematurely. </div>



<div><br></div><div>You might also want to add a test to see if you are at the end of the the port, via eof-object?.  </div><div><br></div><div>Also - your chr is not used in your proc.  If that&#39;s the input-port you will want to pass it to peek-char and read-char, otherwise they are read from current-input-port. </div>



<div><br></div><div>Let&#39;s add back the mailing list if you have additional questions, so others might chime in. </div><div><br></div><div>HTH.  Cheers,</div><div>yc</div><div><br></div></div>
</blockquote></div><br><br clear="all"><br></div></div></blockquote></div><br>