<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div><br></div><div><br></div><div>Of course:&nbsp;</div><div><br></div><div><div>#lang scheme</div><div><br></div><div>(define-syntax-rule (while tst {body ...}) (let L () (when tst body ... (L))))</div><div>(define-syntax-rule (:= lhs rhs) (set! lhs rhs))</div><div>(define ! not)</div><div><br></div><div>;; ---&nbsp;</div><div><br></div><div>(define l (mcons 1 null))</div><div>(while (! (null? l))&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; { (printf "~s\n" (mcar l)) ;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; (:= l (mcdr l)) })</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;</div></div><div><br></div><br><div><div>On Jun 12, 2009, at 7:57 AM, emre berat nebioğlu wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I just wonder someone This is possible.Thats it :D<br><br><div class="gmail_quote">On Fri, Jun 12, 2009 at 2:37 PM, Matthias Felleisen <span dir="ltr">&lt;<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""> <div><br></div><div>Why would you want to use while in Scheme? You might as well use Java then :-)&nbsp;</div><div><div></div><div class="h5"><div><br></div><div><br></div><div><br></div><br><div><div>On Jun 12, 2009, at 7:21 AM, emre berat nebioğlu wrote:</div> <br><blockquote type="cite">Can we use while or do while in drscheme.Just i wonder.I mean that<br><br>While(list != null)<br>&nbsp;&nbsp;&nbsp;&nbsp; list=list.cdr<br><br><div class="gmail_quote">On Fri, Jun 12, 2009 at 9:10 AM, Noel Welsh <span dir="ltr">&lt;<a href="mailto:noelwelsh@gmail.com" target="_blank">noelwelsh@gmail.com</a>&gt;</span> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>On Fri, Jun 12, 2009 at 7:05 AM, Captain___nemo&lt;<a href="mailto:mmrasheed@gmail.com" target="_blank">mmrasheed@gmail.com</a>&gt; wrote:<br> &gt; Thanks a lot :)<br> &gt;<br> &gt; Won't it be inefficient building list for large values (say thousands<br> &gt; instead of 10)? Isn't there any direct loop syntax in Scheme?<br> <br> </div>In PLT there are for comprehensions:<br> <br> (for ([i (in-range 10)]) ...)<br> <br> However, it is almost always bad style to use loops like you would in<br> Java. Functional programmers think of expressions creating values,<br> whereas Java's loops are fundamentally imperative. So rather than a<br> for comprehension, I would expect someone to use for/list or another<br> value returning comprehension.<br> <font color="#888888"><br> N.<br> </font><div><div></div><div>_________________________________________________<br> &nbsp;For list-related administrative tasks:<br> &nbsp;<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br> </div></div></blockquote></div><br> <div style="margin: 0px;">_________________________________________________</div><div style="margin: 0px;"><span>&nbsp; </span>For list-related administrative tasks:</div><div style="margin: 0px;"><span>&nbsp; </span><a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a></div> </blockquote></div><br></div></div></div></blockquote></div><br></blockquote></div><br></body></html>