axiom-mail
[Top][All Lists]
Advanced

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

Re: [Axiom-mail] Using eval() in compile spad code.


From: Donald J Bindner
Subject: Re: [Axiom-mail] Using eval() in compile spad code.
Date: Sat, 11 Mar 2006 23:10:05 -0600
User-agent: Mutt/1.5.9i

On Sat, Mar 11, 2006 at 11:27:56PM -0500, Bill Page wrote:
> The problem was only that in SPAD you must provide explicit
> conversions. Sometimes these are not obvious from the behaviour
> of the interpreter which provides many of these automatically.
> The domain Expression has many possible forms of 'eval':
> 
>   )sh Expression Float
> 
> In your case you were probably expecting to call the function
> 
>   eval : (%,Kernel %,%) -> %
> 
> This means that the 2nd argument needs to be converted to a
> 'Kernel Expression Integer' and the 3rd argument needs to be
> of type 'Expression Integer'.

How do you get a feel for this?  If I understand correctly, the
second argument is Kernel Expression Integer and the third
argument is Expression Float.

So does Kernel Expression Integer get promoted to Kernel
Expression Float somehow?  Is this an explicit conversion that
you don't have to provide?

I have my Simpson's rule package working, although I found a
different method.  I did

simple(func:EF, sbf:SBF) ==
      a := lo(segment(sbf)) :: EF
      b := hi(segment(sbf)) :: EF
      x := variable(sbf) :: EF
      eval(func, x, b) - eval(func, x, a)

Apparently I am hitting the function
 eval : (%,%,%) -> %

This works.  But I'm left wondering, which is better?

Actually my questions seem to be almost endless.  For example,
it is legal to multiply an Expression Float by a Float.  Why can
you not divide by a Float?

  a := 2.0 :: Expression Float
  a := a*0.5    -- legal
  a := a/2.0    -- illegal

That seems like the kind of thing to make you pull your hair out.
There must be a good reason for it?

-- 
Don Bindner <address@hidden>




reply via email to

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