This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: more guile for perl refugees (split, join)


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
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]