The question can be reformulated: what Spad has for the tagged union?.
Tagged union in SPAD is something like
Union(i: Integer, f: Fraction Integer, ...)
but I bet, that is not what you want, since it is not equivalent to Haskell.
The initial goal is explained in the first my letter on this subject.
Yes, I understood that part. But you haven't expressed the WHY.
Why would you want to put everything into one big type?
The reason for this question is that in my opinion that goes against the
typed way that one ought to program in SPAD. There must be a better
design. Perhaps you don't need such a DomConstr. So to ask it
differently: What do you want to achieve with your DomConstr? What
cannot be done if do don't have it? Why isn't it enough to have separate
types for INT, FRAC(INT), UP(x,...)?
It must be so that a Spad program
could process constr : DomConstr as a first-class data, in particular,
to extract each part of constr : DomConstr.
That sounds a bit like you want some kind of expression domain (like
SExpression). However that would throw away the actual FriCAS types like
INT, FRAC etc. so I guess, you need something else.
For example, if constr : DomConstr represents the domain
UP(x, Fraction INT),
then, it is possible to extract from it the
tag "UP", variable x, (construction of Fraction INT) : DomConstr,
tag "Fraction", (construction of INT) : DomConstr.
I can only guess, but maybe your wish has to do with selecting the right
function depending on the type of the object at hand???
Ralf
--
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.