Re: [Axiom-math] BasicOperator's %eval property
Martin Rubey <[email protected]> 29 May 2007 15:06:20 +0200
| Newsgroups | gmane.comp.mathematics.axiom.devel,gmane.comp.mathematics.axiom.general |
|---|---|
| Message-ID | <[email protected]> |
"Igor Khavkine" <[email protected]> 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, Martin