[plt-scheme] Re: (newbie question) About Loop

From: Noel Welsh (noelwelsh at gmail.com)
Date: Fri Jun 12 02:10:33 EDT 2009

On Fri, Jun 12, 2009 at 7:05 AM, Captain___nemo<mmrasheed at gmail.com> wrote:
> Thanks a lot :)
> Won't it be inefficient building list for large values (say thousands
> instead of 10)? Isn't there any direct loop syntax in Scheme?

In PLT there are for comprehensions:

(for ([i (in-range 10)]) ...)

However, it is almost always bad style to use loops like you would in
Java. Functional programmers think of expressions creating values,
whereas Java's loops are fundamentally imperative. So rather than a
for comprehension, I would expect someone to use for/list or another
value returning comprehension.


Posted on the users mailing list.