[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [spr7631] Defining a Macro



It' me again.


>> To resume I like to define a function 'build-rhet-axiom' such that the evaluation
>> of (build-rhet-axiom 'dog 'snoopi) returns the expression '[dog [snoopi]].

Excuse me, as mentioned in the rest of the message in question, the output of
(build-rhet-axiom 'dog 'snoopi) is supposed to be the (unevaluated) 
rhet command '(assert:rassert [dog [snoopi]]) instead of '[dog [snoopi]).

> This is like saying you want a C expression like " i = i + 3; "  in lisp.

Not exactly the same. I don't just like to construct something like an 
expression (that makes no sense for my purposes, that's a wrong interpretation of 
the problem formulation).
I rather try to to construct a (Lisp) form that (when evaluated) will cause
the insertion of some axioms into an existing database.

 >> IF RHET is a tool in lisp, then either:
 >> (1) it will provide functions to construct what you want or primitives with
 >>     which to do so.
 >> ...

That's right (cf. statement above).

The square bracket [ is a reader extension in RHET. That's what the function 
'build-rhet-axiom' doesn't work the way I expect. 
I made the experience in a Lisp environment not containing RHET, as you can see
below, it works (thanks to Gabriel Inaebnit and Todd Kaufmann)

   USER(1): (defmacro BUILD-RHET-AXIOM (arg1 arg2)
             `'(rassert [,arg1 [,arg2 ]]))
            BUILD-RHET-AXIOM
   USER(2): (BUILD-RHET-AXIOM 'test1 'test2)
            (RASSERT [ 'TEST1 [ 'TEST2 ]])
   USER(3):

So, the question remains the same, namely:
 Is there an elegant way to define "build-rhet-axiom" (without format and
 read-from-string) such that it returns the expected result,
 even if the square bracket [ is a reader extension? 
 
Thanks in advance.
--akd.