<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Matthias, <br>
<br>
... I will play with your example (it is better than all the words I
spent with my looong<br>
description:<br>
<blockquote
cite="mid:A76BE5E1-663C-473B-9BFF-04710BB63894@ccs.neu.edu"
type="cite">
<div>
<div>Here is what I meant: </div>
<div><br>
</div>
<div>
<div>#lang racket</div>
<div><br>
</div>
<div>(define-syntax-rule</div>
<div> (mm x)</div>
<div> (lambda (w) (displayln `(,x)) (+ w x)))</div>
</div>
</div>
</blockquote>
Ok, fine!<br>
<blockquote
cite="mid:A76BE5E1-663C-473B-9BFF-04710BB63894@ccs.neu.edu"
type="cite">
<div>
<div>
<div><br>
</div>
<div>(define f </div>
<div> (let ([a 10])</div>
<div> (mm a)))</div>
<div><br>
</div>
<div>(f 42)</div>
</div>
</div>
</blockquote>
Let me define my function in a inner scope:<br>
<br>
> (let ((othervar 2) <br>
(f (mm (+ 1 othervar))))<br>
> (f 1) <br>
<br>
it should print 4 but it gives the undefined identifier error.<br>
If I define "othervar" globally (top env) it works (of course!).<br>
<br>
> (define othervar 2)<br>
> (let ((f (mm (+ 1 othervar))))<br>
(f 1)<br>
it prints 4.<br>
<br>
If you ask me why I need to call "mm" with an expression, instead of
a value... like: (mm (+ 1 othervar))<br>
The answer is: my macro "replace" is a constructor of a function...
I would like that this<br>
function could reference external variables (not passed by
parameters): if the reference<br>
extern variable is defined (in the current scope) its value is used,
otherwise the function<br>
must give the "undefined identifier error".<br>
The function I refer to is a "chemical reaction function": it
applies to chemical molecules<br>
(the macro parameters) but it can use reference to external
variables to fire or not the<br>
reaction. Example<br>
<br>
(replace x y by x if (> x top)) -> #<procedure><br>
<br>
says: replace any pair of two molecules (x and y) with only one of
them if<br>
the value of the first is not greater than "top".<br>
<br>
Cheers,<br>
<br>
Maurizio.<br>
<br>
-- <br>
<div class="moz-signature"><a
href="http://it.linkedin.com/in/giordanomaurizio"> <img
src="cid:part1.01050809.03040603@gmail.com" alt="View Maurizio
Giordano's profile on LinkedIn" width="160" border="0"
height="25"></a><a
href="http://it.linkedin.com/in/giordanomaurizio"> </a></div>
</body>
</html>