assigned argument in a procedure (6.1.99)

Eddie Saudrais

I would like to test if an argument of a procedure is or not assigned. The result should be like (assuming test is the name of the procedure) :


The number of arguments is not supposed to be known.

Joe Riel (14.1.99)

The procedure assigned will indicate whether its argument is assigned, however, in order to use this in a procedure (I assume that you want to do something else) the formal parameter must be typed with uneval, i.e.

test := proc(x::uneval) assigned(x) end:

It isn’t possible, I believe, to handle an indefinite number of arguments.

Dr. B. Wald (15.1.99)

This function is part of maple and called assigned . Inside a procedure it works with global and local names. But you have to be carfull. Take


This is because the evaluation of a to 1 take place before the call of f . If you want to pass the variable a (instead of the value of a) to f, you have to use a uneval-quotation in the function call

f('a');

A better way is to declare the parameter of f as an "eval to name" parameter


Now f(a) gives no problem. I hope this helps.

Stanley J Houghton (15.1.99)

In rel 5 I make use of the uneval formal parameter type. This passes the name through, eg as ‘x‘ in the example proc below that does what you want I believe, and can be tested with the built in function ‘assigned‘:


However, if you want the value of x you do need to use eval(x) for the value (or eval(x,n), where n is 2 or greater).