On Sat, Mar 03, 2012 at 01:32:30PM +0400, Serge D. Mechveliani wrote:
>
> []
>
> I need to define a type DomConstr for the domain construction
> descriptions, for a fixed small listed set of standard domain
> constructors -- so far, let them be
> Integer, Fraction, UP.
> For example,
> UP'(x, Fr(Int')) : DomConstr
expresses the construction of the domain UP(x, Fraction INT),
> where UP', Fr', Int' are the type constructors which yield a domain
> construction from other domain constructions and parameters.
> Each tag (UP', POLY', Fr, ResidueRingConstr ...) has its particular
> argument tuple of the parameters and constructions.
> [..]
>
> What is an adequate type (domain) description in Spad ?
>
> I am trying
> --------------------------------------------------------
> category WithConstrSymbol ... Join SetCategory with
> constrSymbol : () -> Symbol
> -- the syntax needs correction
>
> DomConstr ==> Union(Symbol, FrConstr, UPConstr)
> -- instead of disjoint union?
> )abbrev domain FRCONS FrConstr
> FrConstr(d : DomConstr) : WithConstrSymbol with
> frConstrArg : () -> DomConstr
> == add
> constrSymbol() == "Fr" :: Symbol
> frConstrArg() == d
>
> )abbrev domain UPCONS UPConstr
> UPConstr(x : Symbol, d : DomConstr) : WithConstrSymbol with
> upConstrVar : () -> Symbol
> upCoefConstr : () -> DomConstr
> == add
> constrSymbol() == "UP'" :: Symbol
> upConstrVar() == x
> upCoefConstr() == d
> --------------------------------------------------------
>
> []
> I thought of SExpression. But, for example,
> convert[UP', x, coefConstr'] :: SExpressin
> [..]
Now, I try Record:
-----------------------------------------------------------------------
DomConstr ==> Record(dConsName : Symbol, dConsDoms : List DomConstr,
dConsParams : DomConsParams)
-- Domain construction.
-- Examples:
-- Integer -- [INT::Symbol, [], "failed"],
-- Fraction INT -- [Fr, [INT], "failed"],
-- UP(x, Fraction INT) -- [UP, [Fr, [INT], "failed"], [x] ]
DomConsParams ==> Union("failed", List Symbol)
-- will be extended for other cosntructors
-----------------------------------------------------------------------
This is not so precise as `data' in Haskell, because some parts in this
record are not used by some constructors, and the length of the argument
and parameter lists is not restricted according to the constructor.
But I hope, it will work.
I do not know whether there exists a better solution.
Regards,
------
Sergei
[email protected]
--
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.