[plt-scheme] define-syntax help

From: support at taxupdate.com (support at taxupdate.com)
Date: Thu Mar 22 10:58:25 EDT 2007

Obviously my question is not clear.  What I'm looking for is a way to
define the syntax for "lookup", so that it can pick up information from
its context.


Assume that (register test "some value" main) places "some value" in *field-hash*,
under the key 'main.test.    (register value 100 other) places 100 in the hash
under the key 'other.value.  The 'main' and 'other' portions of the syntax simulate
namespaces.

So the usage would be:
     
(lookup test main) transforms to (hash-table-get *field-hash* 'main.test)
(lookup value other) => (hash-table-get *field-hash* 'other.value)

Those are straignt-forward.  It would be convenient to make the first arg to lookup
optional in certain contexts, like:

(register amount (* 2 (lookup value)) other)

which should place 200 in the hash, under the key 'other.amount.  Note that the
lookup "knows" that the context here is the 'other' namespace. Without this
convenience, the user will have to code the above statement as:

(register amount (* 2 (lookup value other)) other)

which is slightly redundant.  The question is, how can I code lookup so that it
knows that 'other' is the missing arg, given the context of the register syntax
in which it is contained?  

Hope this is a little clearer.

Wayne


Posted on the users mailing list.