Bill Page wrote:
>
> On 31 October 2016 at 09:21, Bill Page <[email protected]> wrote:
> > ...
> > Yes, saying that 'Category' has no type, i.e. that 'typeOf(typeOf
> > Type)' should return 'Failed' seems more sensible to me. In that case
> > what FriCAS actually does is worse than what it appeared to be when
> > typing 'typeOf(Category)' in the interpreter.
> >
> > But I also wonder why 'typeOf(Integer)' is 'Type', i.e. that specific
> > category 'Type'. Why not 'Ring' or some other category that 'Integer'
> > satisfies?
>
> Actually, thinking about this again, if 'typeOf' can return a category
> as the type of some domain why doesn't 'typeOf(Integer)' return
> exactly the category that appears to the right of the : when 'Integer'
> is defined?
>
> Integer : Join(IntegerNumberSystem, LinearlyExplicitOver Integer,
> PolynomialFactorizationExplicit, ConvertibleTo String,
> OpenMath, Canonical, canonicalsClosed) with
> random : % -> %
> ++ random(n) returns a random integer from 0 to \spad{n-1}.
>
> Yes, this might be a bit awkward except perhaps when used programmaticaly as
> in
>
> (1) -> Float has typeOf(Integer)
>
> (1) true
>
> where the current result seems of little value.
Well, serious implementation of 'typeOf' would do this. As you
noted printing such types may be awkward. Concerning current
implementation: interpreter knows almost nothing about categories
so typically it considers all domains to be just of category 'Type'.
This should be fixed in the future. However, there are a lot of
things to fix. That is why I asked about uses: if there are
important uses, then priority of problem would raise. And if
full fix requires too much effort sometimes we can implement
enough functionality to allow desired use.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.