Le samedi 07 avril 2007 à 02:07 -0400, Bill Page a écrit : 
> On April 6, 2007 12:30 PM Gregory Vanuxem wrote:
> > 
> > At the boot level I want to know if a given type is valid.
> > By type I mean a category or a domain (parametrised if
> > they must be). So for example I want to know that
> > 'Matrix(Character)' and 'Fields' are invalid but not
> > Matrix(Ring) and Matrix(Integer)
> 
> You implied that Matrix(Ring) is valid, but it is not. Perhaps
> this was a typo?

No this is not a typo, I was not very clear, here I consider
Matrix(Ring) as a valid type. Something on which I can work at the boot
level (this is probably different than a "real" domain, I don't know,
this is in part why I first want to know if I'm working on a valid
type). When I say parametrised I consider a category as a valid
parameter. I can not rely on the interpreter and what it returns or on
some parts of the functions available in the src/interp directory (there
are also 'new' and 'old' functions).

(8) -> DirectProduct(3,IntegerNumberSystem)

   (8)  DirectProduct(3,IntegerNumberSystem)
                                      Type: Domain
(9) -> [1,2,3]::%
 
   >> System error:
   NIL is not of type CONS.

The interpeter considers DirectProduct(3,IntegerNumberSystem) as a valid
domain (type ?) :-( 


> The definition of Matrix is
> 
>   Matrix(R:Ring)
> 
> I wonder if you mean something like: since both
> 
>   Integer has Ring
>   Field has Ring
> 
> are true, why not both
> 
>   Matrix(Integer)
>   Matrix(Field)
> 
> Field of course, is a category while Integer is a domain.

> > There are several functions in the interpreter for that but
> > they are 'interactive' functions (in the sense that they will
> > throw an error if the type is not valid) or they do not accept
> > all possible categories. There is, for example, the function
> > 'isValidType' but it seems to only accept domains and simple 
> > categories.
> 
> Can you give an example of a valid category for which isValidType
> does not return T?

No, I thought, but I was wrong  :-(, thanks for pointing this out.
Think of a category, here, as the set of matrices over a ring
(Ring being a category in the Axiom sense).

> isValidType seems to work for me (of course this is just the
> interpreter but the equivalent must work in Boot):
> 
> (1) -> mytype1:=["Matrix"::Symbol::SEX, ["Integer"::Symbol::SEX]::SEX]::SEX
> 
> 
>    (1)  (Matrix (Integer))
> 
>                                         Type: SExpression
> (2) -> mytype2:=["Matrix"::Symbol::SEX,
> ["Character"::Symbol::SEX]::SEX]::SEX          
> 
>    (2)  (Matrix (Character))
>                                         Type: SExpression
> 
> (3) -> mytype3:=["FiniteSetAggregate"::Symbol::SEX,
> ["Integer"::Symbol::SEX]::SEX]::SEX
> 
>    (3)  (FiniteSetAggregate (Integer))
>                                         Type: SExpression
> 
> (4) -> isValidType(mytype1)$Lisp
> 
> 
>    (4)  T
>                                         Type: SExpression
> 
> (5) -> isValidType(mytype2)$Lisp
> 
>    (5)  ()
>                                         Type: SExpression
> 
> (6) -> isValidType(mytype3)$Lisp
> 
>    (6)  T
>                                         Type: SExpression

Yes, I was not clear. I do not have a clear overview of what Axiom
does behind the scene but I suspect some error from my part and
I must put out some simple mistakes.

> > The nirvana would be a function that accepts things like
> > Matrix(Join(Foo,Bar)) [1].
> 
> I do not understand what you mean by this.

I want to know if I can extract information from what I call a
valid type, i.e:

)bo Matrix(Join(Field(),ConvertibleTo(InputForm())))

(|Matrix| (|Join| (|Field|) (|ConvertibleTo| (|InputForm|))))
Value = #<(SIMPLE-VECTOR 72) {10053B01FF}>

I'm interested by this vector :-).

[...]

> > 
> > Am I thinking wrong ?

I was...

Greg




_______________________________________________
Axiom-developer mailing list
Axiom-developer@nongnu.org
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to