[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: loop translations (was: Re: language translator help)
From: |
rm |
Subject: |
Re: loop translations (was: Re: language translator help) |
Date: |
Sun, 28 Apr 2002 11:52:43 +0200 |
User-agent: |
Mutt/1.3.24i |
On Sun, Apr 28, 2002 at 01:06:52AM -0400, David Pirotte wrote:
If you are looking for common lisp like loop constructs,
Rick Taube has written a set of macros. I've wrapped them as a guile
module, send me mail if you need them (orig. code is GPL).
Ralf Mattes
> I would do this:
>
> 1. defining a 'do' whatever module, mine has the following 2 defs;
>
> ;; this is my 'do.scm' file, in 'alto' directory accessible
> ;; which means a subdirectory of the ones listed in GUILE_LOAD_PATH
>
> (define-module (alto do))
>
> (export dotimes
> dolist)
>
> (use-modules (ice-9 syncase))
>
> (define-syntax dolist
> (syntax-rules ()
> ((dolist (?var ?ls) . ?body)
> (for-each (lambda (?var) . ?body) ?ls))
> ((dolist (?var ?ls ?result) . ?body)
> (begin (for-each (lambda (?var) . ?body) ?ls)
> ?result))))
>
> (define-syntax dotimes
> (syntax-rules ()
> ((dotimes (?var ?count . ?result) . ?body)
> (let ((limit ?count))
> (do ((?var 0 (+ ?var 1)))
> ((>= ?var limit) . ?result)
> . ?body)))))
>
> ;; end of file
>
> now it is 'very' simple, as simple as:
>
> (use-modules (alto do))
>
> (dotimes (i 3)
> ;; here comes what ever and how many sexp you wanado ...
> (display i) (display "\n")
> )
>
> hope this helps
> david
>
>
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user
- Re: language translator help, (continued)
- Re: language translator help, Thien-Thi Nguyen, 2002/04/29
- Re: language translator help, MJ Ray, 2002/04/30
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/30
- Re: language translator help, Neil Jerram, 2002/04/28
- Re: language translator help, Thomas Bushnell, BSG, 2002/04/28
- Re: language translator help, Per Bothner, 2002/04/28
- Re: language translator help, Neil Jerram, 2002/04/28
loop translations (was: Re: language translator help), John W. Eaton, 2002/04/27
Re: loop translations (was: Re: language translator help), Marius Vollmer, 2002/04/28
Re: loop translations (was: Re: language translator help), John W. Eaton, 2002/04/28
Re: loop translations (was: Re: language translator help), Marius Vollmer, 2002/04/28
Re: loop translations (was: Re: language translator help), Marius Vollmer, 2002/04/28
Re: loop translations (was: Re: language translator help), Clinton Ebadi, 2002/04/29
Re: loop translations (was: Re: language translator help), Eric E Moore, 2002/04/29
Re: loop translations (was: Re: language translator help), Eric E Moore, 2002/04/30
Re: loop translations (was: Re: language translator help), Neil Jerram, 2002/04/28
translators and scoping rules (was: Re: language translator help), John W. Eaton, 2002/04/27