[plt-scheme] Newbie macro problem
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
rest)))))])
(apply format str rest)))
No 'count-format-arguments' required.
And very elegant, I might add.
john