Question: last name evaluation

I have been grappling with the Maple concept of last name evaluation and would appreciate a more detailed explanation than is available in the Programming Guide (too brief) or the help page (confusing).

What I think I understand is this: Normally, Maple evaluates an expression fully until all assignments are resolved, leaving me with an expression having only "values" (in a generalized sense, could be strings, numbers, what have you) and "names", which are variables not having been assigned anything yet.

Per the help page; "...a name assigned to a value that is one of the special types, such as procedures, modules and tables (hence, matrices, vectors and arrays, but not rtables), is not fully evaluated during normal evaluation." As written I do not understand this sentence: One does not "assign a name to a value" (which would be like 3:=a) but rather one assignes a value to a name (a:=3). Furthermore, semantically I cannot figure out what entity is "one of the special types": Is it the "name" (that is being assigned to a value??) or is it the "value" that is being assigned to a "name" (seemingly inconsistent with the (nonsensical, IMO) first part of the sentence).

I venture a guess: A "value" that is "one of the special types" is being assigned to a "name" (a variable), lets call the name a. Evaluation of any (sub-)expression (call it xpr) containing a will stop at a... unless I explicitly type eval(xpr)...??

Furthermore, the help page is not explicit about which entities trigger last name evaluation. Is it ONLY procedures, modules and tables? rtables are Vectors, Matrices and Arrays (so these evaluate fully?); what about lists or sets? Is there somewhere a complete and definitive list of entities that incur last name evaluation?? Can I affect this behaviour (i.e. turn it on or off for certain types)?

As you can see; I interpret "last name evaluation" to mean "evaluation up-to-but-excluding the last name assigned," which is kind-of the opposite (in a literal sense) of "last name evaluation". But by now I may be hopelessly confused...

The context of all this is that I am working on a package with numerous procedures and new types (implemented as records), using tables and lists and Vectors and Matrices, and I keep bumping at unexpected evaluation behaviour esp. of the parameters, i.e. sometimes an evaluation goes too far & sometimes I get an unevaluated name where I expect its value. I get the impression that records incur last name evaluation whereas their "properties" (like rec:-prop) do not. I am learning about the usefullness of eval(xpr,n) to control evaluation depth in this context. I can probably figure this all out in due time, but someone must have worked through this already so I am looking for input to help me homing in to full understanding and get to evaluation-nirvana faster.

FWIW, I am using Maple 15. I don't think this is version-specific, however.


Mac Dude

Please Wait...