From: "Marco Maggi" <marco.maggi-ipsu@poste.it>
To: "guile-user" <guile-user@gnu.org>
Subject: Re: Looping local binding
Date: Tue, 30 Oct 2007 19:03:08 +0200 [thread overview]
Message-ID: <JQQI18$BE1739F41A01350DD56F36909E9338C1@poste.it> (raw)
(define-module (doit)
#:use-module (ice-9 format)
#:use-module (ice-9 getopt-long)
#:use-module (ice-9 syncase))
(define-syntax let-numeric-options
(syntax-rules ()
((_ ?options-list (?option ...) ?body ...)
(let ((?option (string->number
(option-ref ?options-list
(quote ?option)
(number->string ?option))))
...)
?body ...))))
(define-syntax print-option
(syntax-rules ()
((_ ?option)
(format #t "~A~/= ~A~%" (quote ?option) ?option))))
(define *grammar*
'((method (value #t))
(right-bound (value #t))
(wave-number (value #t))
(subintervals (value #t))
(test-epsilon (value #t))))
(define (test args)
(let* ((options (getopt-long args *grammar*))
(method (option-ref options 'method "fundmatrix"))
(right-bound 1)
(wave-number 2)
(subintervals 3)
(test-epsilon 4)
(separator (lambda ()
(display (make-string 30 #\-))
(newline))))
(let-numeric-options options
(right-bound wave-number subintervals test-epsilon)
(separator)
(print-option method)
(print-option right-bound)
(print-option wave-number)
(print-option subintervals)
(print-option test-epsilon)
(separator))))
(test '("the-command"))
(test '("the-command" "--right-bound=123" "--subintervals=456"))
(test '("the-command" "--subintervals=456"
"--test-epsilon=123"))
(test '("the-command"
"--method=minkowsky-space-time-chess-opening"
"--subintervals=456" "--test-epsilon=123"))
;; end of file
--
Marco Maggi
"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next reply other threads:[~2007-10-30 17:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-30 17:03 Marco Maggi [this message]
2007-11-03 10:46 ` Looping local binding Dmitry Dzhus
2007-11-03 11:12 ` Neil Jerram
2007-11-03 18:33 ` Keith Wright
-- strict thread matches above, loose matches on Subject: below --
2007-10-29 16:28 Dmitry Dzhus
2007-10-29 22:12 ` Neil Jerram
2007-11-03 10:46 ` Dmitry Dzhus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='JQQI18$BE1739F41A01350DD56F36909E9338C1@poste.it' \
--to=marco.maggi-ipsu@poste.it \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).