[plt-scheme] Newbie macro problem

From: John Clements (clements at brinckerhoff.org)
Date: Fri Nov 1 13:55:40 EST 2002

On Friday, November 1, 2002, at 12:23  PM, Robert Bruce Findler wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> how about this:
>   (define (flex-format str . rest)
>     (apply format str (sublist rest 0 (count-format-arguments str))))
> No macros required.
> Robby

How about this:

(define (flex-format str . rest)
   (with-handlers ([exn:application:mismatch?
                    (lambda (exn)
                      (apply flex-format str (reverse (cdr (reverse 
     (apply format str rest)))

No 'count-format-arguments' required.

And very elegant, I might add.


Posted on the users mailing list.