Martin,

On Fri, Mar 11, 2011 at 1:50 PM, wrote:
>
> Yes, I agree that we need some common terminology.
>
> The issue is not about a recursive tree structure (or list) consisting
> of a single node type. The existing code in scene.spad works that way
> already and (as far as I can see) so so does:
> http://axiom-wiki.newsynthesis.org/SandBoxAldorInductiveTypes
>

Are we reading the same page?  Why do you say there is a single node type?

Each of MI, MA, and MM are different domains. There is a single
category called ExprCat. It ensures that every domain in this category
can be "evaluated as an integer". There are three domains MkInt,
MkAdd, MkMul which represent integer constants, sum, i.e. an
expressions of the form x+y and product, i.e. expressions of the form
x*y, respectively. There members are literally simple expressions.
Finally, there is one more domain Expr, the domain of general
expressions.  In Expr you see:

   Rep == Sum(MI,MA,MM)

which says literally that an expression is either a constant, a sum,
or a product. Each of MkInt, MkAdd, and MkMul recursively refer to
Expr.

Nothing in this design limits it to a single type of node and MkInt,
MkAdd, and MkMul could be anything at all as long as satisfy some
overal category such as ExprCat.

If you find reference to the categorical functor Sum confusing, it is
very easy to replace it with Union. The original point of this simple
example was in fact part of the argument that Union is best
interpreted as a co-product... but that is another story.

> My issue is how do I divide this into separate node types (domains),
> each with its own data types and a common set of overloaded functions.
> For example draw() that will have the appropriate behaviour for that
> node type. So that when I call draw() on the root this will recurse
> through the tree and each node will draw itself appropriately.
>

I understand that very clearly. What part of this is missing in the
example above?

> We don't know at compile-time what types and how many children a
> given node type will have so the rep need to point to a list of the
> generic category types. The language needs to know at run-time
> which of the overloaded draw() functions to call for that particular
> instance.
>
> What word would you use for that behaviour?
>

Nothing special. This is exactly what Axiom does now.

> I know I have mixed up OO and SPAD terminology in the above
> description.I find myself getting very convoluted in the above
> description because I'm trying to get an agreed terminology without
> getting into the issue of how it might, or might not, be implemented.
> That is I'm trying to avoid talking about how OO data instances have
> run-time pointers to their procedures and SPAD doesn't.
>

Internally SPAD does have such run-time pointers. Remember Axiom is
built on lisp. But you are right to want to avoid focusing on these
low level details.

Regards,
Bill Page.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to