<br><div class="gmail_quote">On Tue, Nov 16, 2010 at 4:58 AM, Peter Breitsprecher <span dir="ltr"><<a href="mailto:pkbreits@lakeheadu.ca">pkbreits@lakeheadu.ca</a>></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't correct. <br>Example. <br>I give it input of '(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'll need to pass in the results from (cons (read-list-helper '()) 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"><<a href="mailto:yinso.chen@gmail.com" target="_blank">yinso.chen@gmail.com</a>></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'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 '() 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'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'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>