[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-math] BasicOperator's %eval property

From: Martin Rubey
Subject: Re: [Axiom-math] BasicOperator's %eval property
Date: 29 May 2007 15:06:20 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Igor Khavkine" <address@hidden> writes:

> Greetings Axiom gurus! Here's some more weirdness that I'd like to
> understand better. I snipped all the "Loading ..." messages. Any
> hints?

Yes. It's not a weirdness, it's a bug.

Here are the relevant bits:

> (3) -> feval1(x:INT):INT == x^2

> (10) -> evaluate(f,feval1)
> (10) ->
>    (10)  f
>                                                           Type: BasicOperator
> (11) -> f(10)
>  11) ->
>    >> System error:
>    ((0 . 10) 0 . 1) is not of type NUMBER.

If you say )se me bo on, you'll see that axiom applies elt(f, 10) from
Expression Integer: it coerces 10 to EXPR INT and succeeds.

The function elt is in fact implemented in ExpressionSpace:

    elt(op:OP, args:List %) ==
      not belong? op => error "Unknown operator"
      ((u := arity op) case N) and (#args ^= u::N)
                                    => error "Wrong number of arguments"
      (v := evaluate(op,args)$BasicOperatorFunctions1(%)) case % => v::%
      okkernel(op, args)

Here comes, what I believe is a bug: belong? is defined in EXPR to give true
always.  It really should check whether the %eval property is from EXPR to
EXPR, if it is set.  Well, there are other possibilities, too, for example, we
could leave the operator unevaluated if the %eval property does not match.  In
any case, currently evaluate(op,args)$BasicOperatorFunctions1(%) blows op.

Could you add it to IssueTracker, please?

Many thanks,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]