I do not know yet what Bnatural is.  But if the axiom interpreter does not
provide automatic coercions and type guessing, you might as well throw it
away.  As Ralf already pointed out, no matter what language you use for
scripting - be it Bnatural (whatever that is) or the current axiom scripting
language - it will never be straightforward to move a script into the library.

In fact, I do not even understand why this is a problem: libraries will, in
most cases be designed quite differently from scripts (if the latter are
"designed" at all).

I have used Aldor, SPAD, the Aldor interpreter and the axiom interpreter quite
intensively, and found the combination Aldor + axiom interpreter formidable.

What I found most impressive is that the axiom interpreter is designed well
enough to work seamlessly with new packages.  A simple example: I have written
operations

   [4] (List Fraction Integer,List GuessOption) -> List Record(function
            : Expression Integer,order: NonNegativeInteger)
            from GuessInteger
   [6] Symbol -> ((List Fraction Integer,List GuessOption) -> List 
            Record(function: Expression Integer,order: NonNegativeInteger))
            from GuessInteger
            if Fraction Integer has RETRACT SYMBOL and Integer has 
            RETRACT SYMBOL
   [10] (List Fraction Polynomial Integer,List GuessOption) -> List 
            Record(function: Expression Integer,order: NonNegativeInteger)
            from GuessPolynomial
   [12] Symbol -> ((List Fraction Polynomial Integer,List GuessOption)
             -> List Record(function: Expression Integer,order: 
            NonNegativeInteger))
            from GuessPolynomial
            if Fraction Polynomial Integer has RETRACT SYMBOL and 
            Polynomial Integer has RETRACT SYMBOL

and it is quite sufficient to type

  guessRat [1,2,3,4]

  guessRat(q) ([1,q,q^2,q^3], [])

  guessRat [1,q,q^2,q^3]

  guess([1,2,6,24], [guessRat], [guessProduct])

and, probably most interestingly

(1) -> )se me bo on
(1) -> l: List EXPR INT := [1,2,3,4]

   (1)  [1,2,3,4]
                                                Type: List Expression Integer
(2) -> guessRat l
 Function Selection for guessRat
      Arguments: LIST EXPR INT 
   -> no function guessRat found for arguments LIST EXPR INT 

 Function Selection for map by coercion facility (map) 
      Arguments: ((EXPR INT -> INT),LIST EXPR INT) 
      Target type: LIST INT 
 
 [1]  signature:   ((EXPR INT -> INT),LIST EXPR INT) -> LIST INT
      implemented: slot (List (Integer))(Mapping (Integer) (Expression 
(Integer)))(List (Expression (Integer))) from LIST2(EXPR INT,INT)
 

 Function Selection for guessRat
      Arguments: LIST INT 
 
 [1]  signature:   LIST FRAC INT -> LIST Record(function: EXPR INT,order: NNI)
      implemented: slot (List (Record (: function (Expression (Integer))) (: 
order (NonNegativeInteger))))(List (Fraction (Integer))) from GUESSINT
 [2]  signature:   LIST FRAC POLY INT -> LIST Record(function: EXPR INT,order: 
NNI)
      implemented: slot (List (Record (: function (Expression (Integer))) (: 
order (NonNegativeInteger))))(List (Fraction (Polynomial (Integer)))) from 
GUESSP
 

 Function Selection for map by coercion facility (map) 
      Arguments: ((INT -> FRAC INT),LIST INT) 
      Target type: LIST FRAC INT 
 
 [1]  signature:   ((INT -> FRAC INT),LIST INT) -> LIST FRAC INT
      implemented: slot (List (Fraction (Integer)))(Mapping (Fraction 
(Integer)) (Integer))(List (Integer)) from LIST2(INT,FRAC INT)
 

   (7)  [[function= n + 1,order= 0]]
    Type: List Record(function: Expression Integer,order: NonNegativeInteger)

I.e., the interpreter realizes that we have a list of INT's (although it is
typed as list of EXPR INT's), and thus uses guessRat$GUESSINT instead of
guessRat$GUESSP.  This situation is quite common in my research, since very
very often the "numbers" (or polynomials) I want to guess formulas for are
coefficients of some Taylor series expansions or more complicated things, and
are only by mathematical coincidence integers.

If you want axiom to use GUESSP you can type

  guessRat(l)$GUESSP

of course.

Martin



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

Reply via email to