From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Marco Maggi" Newsgroups: gmane.lisp.guile.user Subject: Re: Looping local binding Date: Tue, 30 Oct 2007 19:03:08 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1193764173 422 80.91.229.12 (30 Oct 2007 17:09:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2007 17:09:33 +0000 (UTC) To: "guile-user" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Oct 30 18:09:36 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Imuaq-0007AV-OD for guile-user@m.gmane.org; Tue, 30 Oct 2007 18:09:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Imuah-0001oi-3w for guile-user@m.gmane.org; Tue, 30 Oct 2007 13:09:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ImuUi-0003nL-QH for guile-user@gnu.org; Tue, 30 Oct 2007 13:03:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ImuUh-0003lp-6y for guile-user@gnu.org; Tue, 30 Oct 2007 13:03:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ImuUg-0003lS-Tf for guile-user@gnu.org; Tue, 30 Oct 2007 13:03:10 -0400 Original-Received: from relay-pt3.poste.it ([62.241.4.129]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ImuUg-00017p-JB for guile-user@gnu.org; Tue, 30 Oct 2007 13:03:10 -0400 Original-Received: from poste.it (192.168.144.50) by relay-pt3.poste.it (7.3.122) (authenticated as marco.maggi-ipsu@poste.it) id 4726749000005CE8 for guile-user@gnu.org; Tue, 30 Oct 2007 18:03:08 +0100 X-Sensitivity: 3 X-XaM3-API-Version: 4.3 (R1) (B3pl19) X-SenderIP: 131.175.7.1 X-detected-kernel: by monty-python.gnu.org: Solaris 9 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6251 Archived-At: (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~/=3D ~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=3D123" "--subintervals=3D456")) (test '("the-command" "--subintervals=3D456" "--test-epsilon=3D123")) (test '("the-command" "--method=3Dminkowsky-space-time-chess-opening" "--subintervals=3D456" "--test-epsilon=3D123")) ;; 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