[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Wrapping C's printf
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Wrapping C's printf |
Date: |
Wed, 31 Oct 2007 07:27:25 +0100 |
On 10/31/07, Ozzi <address@hidden> wrote:
> I'd like to wrap C's printf so that I can do something like this:
>
> (c-printf "The %s of %d and %d is %d" "sum" 1 1 2)
>
> Which would print "The sum of 1 and 1 is 2."
>
As Z. pointed out, the "$" macro can do this to some extent,
but it's a bit ugly. A pure Scheme implementation that (IIRC)
comes relatively close to C's printf is part of slib:
http://trac.callcc.org/browser/slib/printf.scm
cheers,
felix