[Aldor-l] Functions and Expression trees

Stephen Watt watt at scl.csd.uwo.ca
Sat May 6 06:18:11 EDT 2006


There is one partial solution that does not involve inspecting the code:

If the function is generic, say over a Ring, then you can build the 
expression tree by running the function instantiated over the expression type.
E.g.  If the function is exported by Package1(R), then 
Package1(SomeExpressionType)  will have the + and * operations from 
SomeExpressionType, so f(symbol1, symbol2) will build the tree you want.

-- Stephen

On Sat, May 06, 2006 at 07:36:26AM +0200, Christian Aistleitner wrote:
> Hello,
> 
> > my current work involves converting aldor objects to and from OpenMath
> > format, via. the ExpressionTree type (from the algebra lib.). I'm a bit
> > stuck when it comes to function objects, I don't seem to be able to get a
> > handle on anything, the signatures of the functions or the body of the
> > function.
> >
> > It would be really nice to have an extree(f) function [...]
> 
> I am not convinced that I understood, what you are looking for, but I
> assume, you want a function extree, such that extree(f) with
> f( a: Integer, b: Integer ) == { a + 4*b + a*b; }
> gives you the expression tree
> ( + a ( * 4 b ) ( * a b ) )
> .
> 
> Honestly, I do not know of a way to do this. And I do not think, there is
> a way to implement such a function. Such a function would require that the
> Aldor code would know by itself, what it is doing.
> 
> 
> However, there may be two starting points to look for information:
> 
> - Aldor's Trace package allows to print the name of a domain (including
> its parameters).
> - Given the identifier f of the previously defined function, it is
> possible to obtain a pointer to a string "f" -- with a lot of trickery,
> debugging turned on and assuming, you are allowed to call the function to
> get its name. I could detail on that, if it would be helpful for you.
> 
> 
> --
> Kind regards,
> Christian
> 
> _______________________________________________
> Aldor-l mailing list
> Aldor-l at aldor.org
> http://www.aldor.org/mailman/listinfo/aldor-l



More information about the Aldor-l mailing list