On Fri, Mar 09, 2012 at 10:31:23AM +0100, Ralf Hemmecke wrote:
>> 2. Change the line after `-- (I)' to the next (commented) line - of
>> Product(...),
>> Change the line after `-- (II)' to the next (commented) line - of
>> eDom := construct(...).
>> Then, the comipler reports the error of somewhat
>> "SetCategory is not a LIST".
>>
>> But may be, I guess now -- why!
>> Because the class SetCategory is not a member of SetCategory,
>> and even not of a LIST
>> (while Record does not apply such a restriction).
>> If so, then there remains only the first question.
>
> [..]
> You try to construct
>
> Product(DomainConstruction, SetCategory)
>
> However, the following shows you that this cannot work.
> [..]
> You give "SetCategory" as "B". But SetCategory is not of type
> SetCategory. So this must fail.
I see.
> I agree, however, that the error message, is quite confusing.
Why? Before checking SetCategory, it, probably checks the membership to
LIST. And reports that it is not of LIST (so Product is not applicable).
If so, then the report is precise.
> As for
>
> Warnings:
> [1] coerce: dConsBasic has no value
>
> I think, you can safely ignore this.
>
> -----------
> Side remark. I find
>
> Rep := Union(dConsBasic : Symbol, dConsFr : %)
>
> rather strange. In particular the %. You basically say, that a
> DomainConstruction is either a Symbol or it is itself. Do you want to
> express, that DomainConstruction is a list of Symbols? If yes, then I
> would simply write
>
> Rep == List Symbol
This is important.
I did not mean this what you write.
In reality, it is
UPConstr ==> Product(Symbol, %)
Rep := Union(dConsBasic : Symbol, dConsUP : UPConstr,
dConsFr : % )
Rep is the representation for DomainConstruction.
In
dConsUP : Product(Symbol, %)
"%" denotes the coefficient domain construction for UP.
In
dConsFr : %
"%" denotes the construction of the domain to which Fraction is applied.
My intention was to mimic the Haskell data
data DomainConstruction =
DConsBasic Symbol -- like Integer
| DConsUP (Symbol, DomainConstruction)
-- for UP(x, CoefficientDomain)
| DConsFr DomainConstruction -- for Fraction ArgumentDomain
So, I replaced DomainConstruction with % ...
I wonder: how to express this notion correctly?
I write in DomainConstruction:
OF ==> OutputForm
frDomConstr : % -> %
upDomConstr : (Symbol, %) -> %
frDomConstr d == [d]
upDomConstr(x, d) == [construct(x, d) $UPCons]
coerce(c : %) : OF ==
c case dConsBasic => c.dConsBasic :: OF
c case dConsFr => hconcat["(Fr ", coerce(c.dConsFr), ")"]
c case dConsUP =>
pair1 := c.dConsUP
v := first pair1
cDomCons := second pair1
hconcat["(UP ", v ::OF, SPACEOF, coerce(cDomCons), ")"]
I apply parseDomainConstruction "(Fr INT)",
and print the result -- via this `coerce'.
And it prints "(Fr INT)".
The impression was that it treats DomainConstruction as I intended.
But now, I doubt.
May be, to set there ..., dConsFr : Product(None, %)
?
Thank you for your notes,
------
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.