From: Pascal J.B. <pj...@in...> - 2004-03-10 18:05:49
|
Hoehle, Joerg-Cyril writes: > Hi, > > Pascal J.Bourguignon wrote: > >(defconstant +space-list+ '(#\newline #\Return #\Linefeed > >#\space #\tab #\page)) > >;; Note, usually, I prefer to keep characters in strings, > >;; and using POSITION instead of MEMBER. > >;; It's just harder to come with a string literal containing > >these characters. > > Uh? What about > (coerce '(#\newline #\Return #\Linefeed #\space #\tab #\page) 'string) Nice! Thank you. Up to now I used FORMAT to do the same, but this sounds better. > Come on, constant values in Lisp can be computed and result from > complex computations, unlike preprocessor literals in C. > > Ok, such string literals are not so nice when printed or while in > the debugger, but that's not the reason you invoke. " ^M ^L" > > I agree that another case is slightly harder: a mixture of text and > #\newline in between. E.g. I myself tend to dislike invoking FORMAT > to achieve constant strings with embedded newlines like in > (defconstant +foo+ (format nil "First line~%Another line~%")) > But your example with only special characters does not fall into > this category. > > Regards, > Jörg Höhle. -- __Pascal_Bourguignon__ http://www.informatimago.com/ There is no worse tyranny than to force a man to pay for what he doesn't want merely because you think it would be good for him.--Robert Heinlein http://www.theadvocates.org/ |