Take at look at Racket's `for' loops. They are very flexible.
The reference:
http://docs.racket-lang.org/reference/for.html?q=for#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for%29%29
The guide with examples:
http://docs.racket-lang.org/guide/for.html


On Sun, Apr 1, 2018 at 10:14 AM, 若草春男 <whbug...@gmail.com> wrote:

> Hi, everyone.
>
> I want to write loops simpler.
>
> > (do ([i 1 (add1 i)]) ([= i 10]) (display i))
> 123456789
> > (for-each (lambda (i) (display i)) (range 1 10))
> 123456789
>
> In Common Lisp, I like the extended loop like "for" of C-language.
>
> [3]> (loop for i from 1 below 10 do (print i))
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> NIL
>
> Please tell me the best solution.
>
> Haruo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to