<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>Consider:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>#lang scheme</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(require (for-syntax some-library)) ;
exports procedure F : string ... --> procedure</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define-syntax (do-at-compile-time-only
stx)</FONT></DIV>
<DIV><FONT face="Courier New" size=2> (syntax-case stx ( )</FONT></DIV>
<DIV><FONT face="Courier New" size=2> ((_ name .
list-of-strings)</FONT></DIV>
<DIV><FONT face="Courier New" size=2> (let ((list-of-strings
(syntax->datum (syntax list-of-strings))))</FONT></DIV>
<DIV><FONT face="Courier New" size=2> (if (andmap string?
list-of-strings)</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
(quasiquote-syntax</FONT></DIV>
<DIV><FONT face="Courier New" size=2> (define
name</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
(unquote-syntax</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
(apply F list-of-strings))))</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
(raise-syntax-error etc))))))</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(provide
do-at-compile-time-only)</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Require the above module</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(do-at-compile-time-only f "string"
...)</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(f arg ...) </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>I did some tests with this. It seems to
work alright, but I cannot find it as a documented feature, which makes me
suspicious. Can it be trusted? </FONT><FONT face="Courier New" size=2>Of
course syntax do-at-compile-time-only must be given string-constants. It does
not accept exprs that evaluate to strings. </FONT><FONT face="Courier New"
size=2>For a simple procedure F, simply writing (define f (F "string" ...)) may
be optimized such as to evaluate (F "string" ...) once only at compile time. I
don't know whether or not the optimizer does do such things, but
anyway I'm afraid my F is too complicated for the optimizer such as to
detect that (F "string" ...) is in fact a constant across various run times and
threads. The whole idea is to apply F once during compilation in order that
there is no need to call F during every run time.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Kind regars, Jos</FONT></DIV></BODY></HTML>