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?

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?

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

> The nirvana would be a function that accepts things like
> Matrix(Join(Foo,Bar)) [1].

I do not understand what you mean by this.

> 
> Issues related are visible in the interpreter, try to type 
> Matrix(Field) and List(Field).
> 
> Am I thinking wrong ?
> 

I think your examples are a little confused. Something can not
be a Field without also being a Ring, right?

Integer has Ring

Matrix(Integer)

Fraction Integer has Field

Fraction Integer has Ring

Matrix(Fraction Integer)

> Or may be you have some ideas or you know some functions that
> do what I'm looking for ?
> 

Maybe you could give another example?

Regards,
Bill Page.




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

Reply via email to