[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: loop translations (was: Re: language translator help)
From: |
David Pirotte |
Subject: |
Re: loop translations (was: Re: language translator help) |
Date: |
Sun, 28 Apr 2002 01:06:52 -0400 |
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
- Re: language translator help, (continued)
- 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