[racket] Splicing format string?
Have a look at planet-fmt in Planet. The docs are in a msword doc file
(under browse)
Gives you iteration, tabulation, allignment and more.
(apply (fmt "!d*(xd)") syms) or
((fmt "us!d*(xd)") syms)
!d : display only if the list is not empty
* : repeat until no more elements
xd : display a space and one element
(...) : compound
Jos
-----Original Message-----
From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of J. Ian Johnson
Sent: jueves, 01 de septiembre de 2011 15:44
To: users
Subject: [racket] Splicing format string?
I have a list of symbols '(a b c) that I want to be printed "a b c" as part
of string I'm formatting. Instead of writing
[assume the list is bound to syms]
(format "~a" (string-join (map symbol->string syms) " "))
I'd much rather write something like
(format "~@a" syms)
And have format do this for me.
1) Would other people also like this as part of format strings?
2) Is there a better way to write my first attempt without changing format
string?
-Ian
_________________________________________________
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users