Thank you for the reference to the documentation.  In fact this
documentation is incorrect.  There are a few examples in the Axiom
library of Records whose components do not necessarily satisfy
SetCategory, for example the domain ILogic.

(11) -> ILogic has SetCategory

   (11)  false
                                                                Type: Boolean
(12) -> R:=Record(A:ILogic)

   (12)  Record(A: ILogic)
                                                                   Type: Type
(13) -> R has SetCategory

   (13)  true
                                                                Type: Boolean

I suppose that the implementation of Record should be a little more
intelligent and not export SetCategory if at least one of its
components does not have SetCategory.

But for practical purposes almost all domains do satisfy SetCategory.
All this means in mathematical terms is that the domain implements
some form of equality, can be converted to an OutputForm and that is
supports a hash operation.

--

I think it might be difficult to get dom$Any to work the way you want
since the result is an SExpression. It is important to remember that
in Spad all types are static and must in general be fully determined
at compile time.  The domain Any is probably most useful in the
interpreter.

In the compiler I would prefer to use Union.

--

I think your questions and persistence are commendable even if at
times answering the questions might seem a little annoying. I hope you
will continue to ask and also to point out the obvious. Perhaps FriCAS
will be improved and you will achieve your goal!

On Tue, Feb 14, 2012 at 12:30 PM, Serge D. Mechveliani <[email protected]> wrote:
> On Tue, Feb 14, 2012 at 09:19:05AM -0500, Bill Page wrote:
>> Record does not need SetCategory.  Could you give specific reference from
>> docs?
>
> Click  "Browse -- Record -- Constructor"   in on-line docs:
>
> -------------------------------------------------------
>  Domain  Record(a: A, ... b: B)
>
>  a  a selector ...,
>  A  a domain of SetCategory
>  ...
>  b  a selector ...,
>  B  a domain of SetCategory.
>  ...
> -------------------------------------------------------
>
> And I naively presumed that  Any  is not of  SetCategory.
> But now, again  Browse -- Any -- domains  reports that it is of
> SetCategory.
>
>> [..]
>> You could try eliminating the 'dom' component of the Record.  The Any
>> type already includes it anyway. Perhaps there is also a conflict of
>> function names versus tags.
>>
>> -----------------------------------------
>> ANY1          ==> AnyFunctions1
>> SetAnyLexList ==> Record( val : Any, remList : List String)
>>
>> )abbrev package FOO Foo
>> Foo() : with    p : List String -> SetAnyLexList  ==
>>  add
>>    p(lexs : List String) : SetAnyLexList ==
>>                               [coerce(1) $ANY1(Integer), rest lexs]
>> -----------------------------------------
>>
>>
>> (2) -> x:=p["a"]
>>
>>    (2)  [val= 1,remList= []]
>>                                  Type: Record(val: Any,remList: List(String))
>> (3) -> x.val
>>
>>    (3)  1
>>                                                                 Type: Integer
>> (4) -> dom(x.val)
>>
>>    (4)  (Integer)
>>                                                             Type: SExpression
>
>
> Thank you.
> I have missed that `dom' is reserved by the standard library.
> I do not know whether this is the reason.
>
> The aim is to parse from  strings  the elements of various domains,
> and each such domain is defined only after parsing. For example,
>
>  "(" "Fr" <nInput> <dInput> ")"
>  is parsed as  (n/d) : Fraction R,   R : Integral domain,
>  R  always occurs concrete, for example, Integer, UPOL(_, Integer) ...,
>  R  is found by parsing things to the bottom;
>
>  "(" "UP" "x1" <monsInput> ")"
>  is parsed as  f : UnivariatePolynomial("x1" :: Symbol, R)
>  R : CommutativeRing,  R concrete,
>
>  and so on, for several important domain constructors.
>
> 1. Now, parsing  "(" "Fr" <nInput> <dInput> ")"
> :
> <nInput> is parsed recursively to some  n : R.
> <dInput> is parsed recursively to some  d : R.
> To form  fr := n/m  the program needs to coerce it to  Fraction R,
> where a concrete  R  must by found from the input.
> So, I defined that  dParse  returns the target domain as the first
> component of the result:  record  SetAnyLexList.
> Thus  dParse(.. <nInput>)  yields some  R  and  n: R,
> and  R pretend IntegralDomain.
> Then  dParse (.. <dInput>)  uses this R, because (I thought that)
> knowing a concrete domain helps to parse faster.
> And then,  Fraction R  is used to coerce  n/d  to  Fraction D
> (otherwise, how to create a fraction from n and d?).
> I know too few of Spad.
> Is this a reasonable approach?
> At least, it works in the version withe  List Any,  with coercing
> SetCategory to Any, etc.
> Now, with Record, it must be simpler.
>
> 2. Now, you suggest to remove the first in the Record
>
> and to use the library  dom:
> parse  <nInput>  to  n,  put  R := dom n,  and then use R if needed.
> Right? Is this a reasonable approach?
>
> Which way is better?  Will  dom(n)  work as needed?
> Anyway, I have to try and find out. But an advice makes it faster.
>
> Thanks,
>

-- 
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