what do these mean?



On 6/12/07, sen1 at math.msu.edu <sen1 at math.msu.edu> wrote:

> So, it seems silly to define
>    f(x):= linearinterpol([[2,1],[3,2],[4,1]])
>
> Rather, it seems more appropriate to use
>    expr_1: linearinterpol([[2,1],[3,2],[4,1]])
>
> Since I am generally interested in using the actual interpolating
> function, what is the best way to define it?

The way it is shown in the example, with

linearinterpolation_or_whatever (a, b, c);
f(x) := ''%;

is very often useful.

Alternatives which have the same result:

f(x) := ''(linearinterpolation_or_whatever (a, b, c));

define (f(x), linearinterpolation_or_whatever (a, b, c));

The key point here is that ":=" does not evaluate
(and does not even simplify) its right-hand side.
So when you enter f(x) := some_function();
the some_function is not called then.
some_function is only called later when f is called.

The quote-quote ''(...) causes (...) to be evaluated (i.e.
some_function is called), where it would otherwise not be.

HTH
Robert