Question: Help Understanding the Working of a Procedure

Here's an example procedure that I need help with in order to figure out how it produces certain cases of it's output. First, in the case when the argument n is negative does the procedure call itself again in the denominator of the fraction and return the value of the last line of the procedure (inside the inner call to itself)? I also assumed that the special identifier procname was not in unevaluation quotes in order to allow evaluation. Next, I also don't understand how the output for cases when the exponent n is even is produced. What's really confusing is the use of the anonymous mapping (x -> x.x), and also the meaning of the entire expression after the word then. Is that a multiplication of the two expressions in parentheses ? i.e. (x -> x.x)(procname(X, n/2) > Pow := proc(X, n::integer) if n <> x.x)(procname(X, n/2)) else X.procname(X, n-1) end if end: > Pow(5,5) = 5^5; > Pow(5, -5) = 5^(-5); > This post generated using the online HTML conversion tool Download the original worksheet
Please Wait...