[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-mail] Generating rules in functions or macros
From: |
Gerald Knizia |
Subject: |
Re: [Axiom-mail] Generating rules in functions or macros |
Date: |
Wed, 30 Jul 2008 05:04:19 +0200 |
User-agent: |
KMail/1.9.1 |
On Tuesday 29 July 2008 07:12, Martin Rubey wrote:
> Gerald Knizia <address@hidden> writes:
> > Is there some way to accomplish something like that? Am I missing
> > something important in they way axiom works? If using functions or macros
> > above does not seem to make any difference.
>
> Maybe you are looking for
>
> eval(expr, [kernel=replacement])
>
> or
>
> eval(expr, operator, arglist +-> transformation(arglist))
Hm.. the eval doesn't seem to be applicable to RewriteRule-objects. I was not
able to modify a rule using it.
Perhaps, to clarify: I'm not after this particular function F, but trying to
use parameterized rulesets in a more general context. The F is just the
simplest rule I could think of.
Maybe I should rephrase my problem. Currently I get this:
(1) -> F(x,y) == (rule 'x == y)
Type: Void
(2) -> F(A,B)
Compiling function F with type (Variable A,Variable B) ->
RewriteRule(Integer,Integer,Expression Integer)
(2) x == y
Type: RewriteRule(Integer,Integer,Expression Integer)
How does the function F need to be defined such that the result of F(A,B)
is equal to the one of
rule 'A == B
and the result of F(C,D) is equal to
rule 'C == D
? I am particularly puzzled by the fact in (2) above, not only the function
argument x is not evaluated, but y also is not (although unquoted).
If I make F a macro instead of a function, in y in F(A,B) is properly
replaced. But x is not (not even when writing '(x) instead of 'x). Shouldn't
macros be a simple text replacements and do this?
--
Gerald Knizia