[quiz] Enhanced Strings in CL ?

Laurent PETIT lpetit at sqli.com
Tue Nov 28 13:26:40 UTC 2006


Hello Quizzers,

I'm a newbie in Lisp (have already finished the ANSI Common Lisp book, made
some tries with programming as well, and I'm searching the answer to this
question I have : could it be possible to "enhance" the reader in order to
have in lisp "enhanced strings".

That is : by just doing something once at the beginning of a lisp file (some
call, ...), being able to have all the strings replaced by another string
(or another form).

Something like this :

;;; beginning of file

(enhanced-strings:start)

...
...

(defun some-function (x y)
   "This returned string is an enhanced string and the value of x and y will
be replaced 'a la ruby' : x=${x}, y =${y}")

You see what I mean ....

This could be an interesting quiz, but first of all, will an ANSI compliant
implementation let redefine the reader to alter the meaning of strings ?

I know I can add macro characters, play with macro character dispatching
functions, ... but what about "overriding" the reader to intercept strings
and change them, as for the above example, with :

(format t "This returned string is an enhanced string and the value of x and
y will be replaced 'a la ruby' : x=~a, y =~a") x y)


thanks in advance for your answers, both on feasibility and/or complete
answers to this "unofficial" quiz ;-)

And oh, if I definitely bothered you by sending this message on the wrong
list, please let me know what would be the most natural list/newsgroup to
post this message on ?


Thanks in advance,

A lisp beginner,

-- 
Laurent PETIT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/quiz/attachments/20061128/0400ccb0/attachment.html>


More information about the Quiz mailing list