<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: </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>;; --- </div><div><br></div><div>(define l (mcons 1 null))</div><div>(while (! (null? l)) </div><div> { (printf "~s\n" (mcar l)) ;</div><div> (:= l (mcdr l)) })</div><div> </div><div> </div><div> </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"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></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 :-) </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> list=list.cdr<br><br><div class="gmail_quote">On Fri, Jun 12, 2009 at 9:10 AM, Noel Welsh <span dir="ltr"><<a href="mailto:noelwelsh@gmail.com" target="_blank">noelwelsh@gmail.com</a>></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<<a href="mailto:mmrasheed@gmail.com" target="_blank">mmrasheed@gmail.com</a>> wrote:<br> > Thanks a lot :)<br> ><br> > Won't it be inefficient building list for large values (say thousands<br> > 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> For list-related administrative tasks:<br> <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> </span>For list-related administrative tasks:</div><div style="margin: 0px;"><span> </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>