CodeTools[ProgramAnalysis]
GenerateProcedure
generate a Maple procedure from a ForLoop or WhileLoop
Calling Sequence
Parameters
Description
Examples
Compatibility
GenerateProcedure(loop)
loop
-
WhileLoop or ForLoop data structure
The WhileLoops or ForLoops generated by CreateLoop can be transformed back into a Maple procedure using GenerateProcedure.
The returned procedure may not be the same as the original procedure processed using CreateLoop. Statements that do not affect the loop variables are removed and the loops are put into a canonical form.
with⁡CodeToolsProgramAnalysis:
Form a procedure:
p := proc (A, n) local i; for i from 1 to n do A[i] := A[+1]^2: end do: end proc;
p ≔ procA,nlocali;foritondoA[i] ≔ A[1]^2end doend proc
Create the related ForLoop data structure:
loop≔CreateLoop⁡p
loop≔Record⁡ForLoop,body=,Ai=A12,layers=i,1,1,n,initialization=,variables=i,parameters=n,arrays=A
Translate the ForLoop loop back into a procedure:
GenerateProcedure⁡loop
procA,nlocali;foritondoA[i] ≔ A[1]^2end do;returnend proc
The CodeTools[ProgramAnalysis][GenerateProcedure] command was introduced in Maple 2016.
For more information on Maple 2016 changes, see Updates in Maple 2016.
Download Help Document