[pro] User defined format functions
Matthew D. Swank
akopa at charter.net
Wed Jan 26 03:18:05 UTC 2011
On 01/25/2011 02:12 PM, Didier Verna wrote:
> Daniel Weinreb wrote:
>
>> > Yes, we use it heavily, mainly for date/time processing, which can be
>> > very complicated when you're dealing with time zones and such.
>> > Example:
>> >
>> > (list :departure-time (format nil "~/zul%ISO8601/" departure-time-zul)
> OK, but does it really buy you anything, compared to just calling a
> specific function directly? Your examples all seem to contain only one
> format directive.
>
Even a single directive is helpful if it's short enough. I try to
mitigate some of the more cumbersome aspects of using ~// by defining a
single generic function, format-value, that has a ~// compatible
argument list. There is an in-lined wrapper function, f, that resides
in a package that has a single letter nickname (of course that invites
other problems). Anyway, I end up using ~/p:f/ in a lot of format
control strings.
Matt
More information about the pro
mailing list