The Maple parameter type checking allows you to specify that a parameter is to remain as a name (that is, x::evaln), while also specifying that this name must be assigned a particular sort of value.
The two types involved in doing this are:
name(<type-specification>)
and
evaln(<type-specification>)
These are semantically equivalent to name and evaln, with the additional restriction that the specified name must be assigned a value that matches the <type-specification>. Note that when making the test on the assigned value, the assigned value is not evaluated any further than it will have been already.
Here, a evaluates to 3, which is not a name with an integer value.
The name b evaluates to 4.5, which is, again, not a name with an integer value.
In the next example, the name a does evaluate to an integer value. The type function itself sees the name a, because it has been quoted.
>
|
type('a',name(integer));
|
Here, the quoted 'b' evaluates to a name, but it is not bound to an integer, so the result is false.
>
|
type('b',name(integer));
|
A function that requires its argument to be an unevaluated name would have an integer value if evaluated.
>
|
f := proc(x::name(integer)) end;
|
| (1.7) |
A function that requires its argument to be a name (implicitly unevaluated) would have an integer value if evaluated.
>
|
g := proc(x::evaln(integer)) end;
|
| (1.8) |