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

From: Captain___nemo (mmrasheed at gmail.com)
Date: Fri Jun 12 02:05:42 EDT 2009

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?



On Jun 12, 12:00 pm, Jon Rafkind <rafk... at cs.utah.edu> wrote:
> MD.MAHBUBUR RASHEED wrote:
> > Hi,
> > How can I implement loop in  plt-scheme like in java-
>
> > for(int i=0;i<10;){
> >      for(int j=0;j<3;){
> >           System.out.println(""+j);
> >           j++;
> >      }
> >       System.out.println(""+i);
> >       i++;
> > }
>
> (for-each (lambda (i)
>                   (for-each (lambda (j) (printf "~a\n" j)) (build-list 3
> (lambda (x) x)))
>                   (printf "~a\n" i))
>                 (build-list 10 (lambda (x) x)))
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.