This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: more guile for perl refugees (split, join)
- To: clark dot mcgrew at sunysb dot edu
- Subject: Re: more guile for perl refugees (split, join)
- From: Jonathan Bartlett <johnnyb at wolfram dot com>
- Date: Wed, 28 Jun 2000 04:59:30 -0500 (CDT)
- cc: tell at telltronics dot org, dirk at ida dot ing dot tu-bs dot de, guile at sourceware dot cygnus dot com
Of course real scheme programmers would just do it with recursion ;)
Jon
On Wed, 28 Jun 2000, Clark McGrew wrote:
>
> Steve Tell wrote:
>
> ; some common idioms:
> ;
> ; for(i = 0; i < 5; i++) printf("hi\n"); becomes:
> ;
> ; (do ((i 0 (+ i 1))) ((>= i 5))
> ; (display "hi\n"))
>
> This has always been one of my bet peeves with scheme. It's looping
> constructs are lousy (IMNSHO). Yeah, I can think of several ways to
> do a loop, but they tend to obscure it's simple nature. I guess what
> I really want is a standard (schemified)
>
> "for i = 1 to 10"
>
> or
>
> "do i = 1, 10"
>
> that is part of the normal guile environment. This sort of trivial
> convenience function can really improve the programing experience. If
> it doesn't belong directy in boot-9, maybe there should be a general
> convenience module "(ice-9 convenience)" (or maybe "(ice-9 7-11)")
> that collects this sort of stuff.
>
> If people (ie the developers) don't think this qualifies as bloat I
> can dig out and polish one of my macros that does a simple "for" loop
> and post it. I tend to use it like
>
> (for (i 1 10)
> (display i)
> (newline))
>
> Cheers,
> Clark
>