challenge: insert a literal reader conditional

Liste des GroupesRevenir à cl lisp 
Sujet : challenge: insert a literal reader conditional
De : enometh (at) *nospam* meer.net (Madhu)
Groupes : comp.lang.lisp
Date : 14. Apr 2025, 03:05:37
Autres entêtes
Organisation : Motzarella
Message-ID : <m3r01vjy4u.fsf@leonis4.robolove.meer.net>
Anyone know of a hack to insert literal reader conditionals in generated
code?

(setq $a '(+ 1 2 3))

assume I want to dump $a to a file, but I want the file to contain the
text

"(+ 1 2 3 #+foo 4)"

is it possible to do this at all without string-replace on the generated
output file?

I'm pretty sure it is not possible theoretically, but maybe there is
some insane hack.

asdf (and now mk-defsystem) solves this by using :IF-FEATURE constructs
that handle some features at read time.
so one can write

     (:FILE "x86_64-pc-linux-gnu" :IF-FEATURE (:AND :X86-64 :LINUX))
and defsystem will expand this to (:file "x86_64-pc-linux-gnu")
when processing the form if the features are present and omit the form
if they are not.

Date Sujet#  Auteur
14 Apr 25 * challenge: insert a literal reader conditional2Madhu
14 Apr 25 `- Re: challenge: insert a literal reader conditional1Madhu

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal