
funcattr  -  access  to  the  attributes  of  a  function

environment

Calling sequence:

funcattr(func_env, expr1)
funcattr(func_env, expr1, expr2)

Parameter:
func_env       --  function environment
expr1, expr2   --  expressions

Summary:

funcattr(func_env, expr1) returns the attribute of the function environment
func_env with the index expr1. If the function does not have an attribute
with this index then it returns the value FAIL.

funcattr(func_env, expr1, expr2) copies the function environment func_env
and enters the attribute expr2 in the copy under the index expr1. The so-
created new function environment is then returned.  If func_env does not
have the type DOM_FUNC_ENV, then the argument is converted into a
function environment.

The attributes of a function environment can be used to store special information
about the represented function. E.g. if the function diff does not know how

to differentiate another function, it searches under the index "diff" for an
attribute that can calculate the derivaive.  Similarily, the function expand
searches under the index "expand" for an attribute that can perform an
expansion.

The attributes of a function are stored in a table in the 3rd entry of a function
environment. funcattr is a kernel function.

>>  funcattr(poly(x^2,[x]), polynom, TRUE);

      poly(x^2, [x])

>>  tan := funcattr(tan, "diff", proc(x, var) begin
        diff(op(x, 1), var)*(1+tan(op(x,1))^2)
    end_proc):
    diff(tan(2*x),x);

      2*tan(2*x)^2 + 2

>>  tan := funcattr(tan, "expand", proc(x) begin
        sin(x)/cos(x)
    end_proc):
    expand(tan(x));

      sin(x) / cos(x)

