[quiz] Enhanced Strings in CL ?

Pascal Bourguignon pjb at informatimago.com
Tue Nov 28 19:23:16 UTC 2006


Pascal Bourguignon writes:
> (defun parse-enhanced-string (string)
> [...]
> (start)
> '"This returned string is an enhanced string and the value of x and y will
> be replaced 'a la ruby' : x=${(* 42 x)}, y =${y}"
> -->
> (format nil
>   "This returned string is an enhanced string and the value of x and y will
> be replaced 'a la ruby' : x=~A, y =~A"
>   (* 42 x) y)

There's a little problem with my function, it doesn't escape #\~ in
the string.  This is left as an exercise for the reader...

(quote "~ ho ho ~ x=#{x} ~")
--> (format nil "~~ ho ho ~~ x=~A ~~" x)

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Litter box not here.
You must have moved it again.
I'll poop in the sink. 



More information about the Quiz mailing list