chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] format-modular usage question


From: Joshua Griffith
Subject: [Chicken-users] format-modular usage question
Date: Mon, 30 Jul 2007 12:23:12 -0500

Hello,

I'm trying to use format to create a string consisting of the cars of a list of lists delimited by commas and enclosed by parentheses. I tried the following statement:
(format #f "(~:{~a~:^, ~})" '((prop1 val1) (prop2 val2) (prop3 val3)))

But it returns:
"(prop1, prop2, prop3, )"

However, I'm trying to get:
"(prop1, prop2, prop3)"

It seems that ~:^ is not escaping on the last element, causing the last comma and space to be emitted. Does anyone know how to modify the format statement to eliminate the last comma and space? I know that I could just map car and format the result, but I'm trying to learn more about format.

Thanks,

Joshua




reply via email to

[Prev in Thread] Current Thread [Next in Thread]