codegen
packparams
pack parameters of a Maple procedure into an array
packargs
packlocals
pack locals of a Maple procedure into an array
swapargs
interchange two arguments in a Maple procedure
renamevar
rename a variable in a Maple procedure
Calling Sequence
Parameters
Description
Examples
packparams(f, X, A)
packargs(f, X, A)
packlocals(f, X, A)
swapargs(f, m=n)
renamevar(x=y, f)
f
-
Maple procedure
X
list of symbols
A
name of array argument
x, y
symbols (parameters in f)
m, n
integers (positions of parameters in f)
The packparams function is used to collect the parameters in the list X into one parameter, an array named A, in the Maple procedure f.
The packargs function is a synonym for the packparams function.
The packlocals function is used to collect the local variables in the list X into one local variable, an array named A, in the Maple procedure f.
The swapargs function is used to swap the formal parameter at position m with the formal parameter at position n in a Maple procedure.
The renamevar function is used to rename a (parameter, local, or global) variable x with the new name y in a Maple procedure.
The command with(codegen,packargs) allows the use of the abbreviated form of this command.
The command with(codegen,packlocals) allows the use of the abbreviated form of this command.
The command with(codegen,swapargs) allows the use of the abbreviated form of this command.
The command with(codegen,renamevar) allows the use of the abbreviated form of this command.
with⁡codegen:
f := proc(x,y,z) local r,s,t; r := x*z; s := y^2; t := r*s; t^2 end proc:
packparams⁡f,x,y,z,A
procA::array⁡1..3localr,s,t;r ≔ A[1]*A[3];s ≔ A[2]^2;t ≔ r*s;t^2end proc
packlocals⁡f,s,t,A
procx,y,zlocalA,r;A ≔ array⁡1..2;r ≔ x*z;A[1] ≔ y^2;A[2] ≔ r*A[1];A[2]^2end proc
swapargs⁡f,1=2
procy,x,zlocalr,s,t;r ≔ x*z;s ≔ y^2;t ≔ r*s;t^2end proc
renamevar⁡x=u,f
procu,y,zlocalr,s,t;r ≔ u*z;s ≔ y^2;t ≔ r*s;t^2end proc
renamevar⁡s=x,f
Error, (in `anonymous procedure created in codegen/renamevar`) parameter and local `x` have the same name
See Also
codegen[declare]
Download Help Document