procmake - Maple Help

Home : Support : Online Help : System : Libraries and Packages : Deprecated Packages and Commands : Deprecated commands : procmake(deprecated)

procmake

create a Maple procedure

 Calling Sequence procmake(neutralform)

Parameters

 neutralform - neutral form'' of a procedure

Description

 • Important: The procmake function has been deprecated.  Use the superseding functions ToInert and FromInert instead to translate between Maple expressions and the corresponding inert forms.
 • This routine takes the neutral form'' of a procedure (such as that generated by procbody) and creates an executable procedure.
 • There are neutral forms'' for statements, local variables, parameters, and several functions.  The function procmake does not require a neutral form'' exactly equivalent to the internal representation. For example, $f\left(a,b\right)$ is accepted as well as $f\left(a&expseqb\right)$ and $f&function\left(a&expseqb\right)$. Similar examples exist for table references, sets, and lists.
 • Do not fully evaluate the neutral form'' as this will probably invoke functions that are part of procedures, such as $\mathrm{indets}\left({\mathrm{&args}}_{-1}\right)$. When entering such function calls, it is best to use the $\mathrm{&function}$ form for example $&\mathrm{function}\left(\mathrm{gcd},&\mathrm{expseq}\left(a,b\right)\right)$ or quote them, as with $'\mathrm{gcd}\left(a,b\right)'$.
 • The short specific neutral form is:
 The expression &proc(A, B, C, D) is a procedure, where:

 A is a list of arguments B is a list of local variables C is a list of options D is the statement sequence

 • The long specific neutral form is:
 The expression &proc(P, L, O, R, B, S, G, X) is a procedure, where:

 P is an &expseq of parameters L is an &expseq of locals O is an &expseq of options R is the remember table &hashtab B is the body &statseq S is the description string G is an &expseq of globals X is the (empty) &expseq of scoped variables

 • Inside a procedure, arguments are represented by ${\mathrm{&args}}_{n}$ where n is the position in A and local variables by &local[n] where n is the position by B. The three special names, nargs, args, and procname, are represented by ${\mathrm{&args}}_{0}$, ${\mathrm{&args}}_{-1}$, and ${\mathrm{&args}}_{-2}$. If there are no statements in the procedure, use $\mathrm{&expseq}\left(\right)$.
 • The expression $&\mathrm{statseq}\left(A,B,C,\mathrm{....}\right)$ is a statement sequence, where A, B, and C are statements.
 • The expression $\mathrm{&expseq}\left(A,B,C\right)$ is an expression sequence, where A, B, and C are expressions.
 • The empty expression sequence (NULL) is represented by $\mathrm{&expseq}\left(\right)$.
 • The expression $A&:=B$ is an assignment statement, where A is assigned the value of B.
 • The expression $&\mathrm{if}\left({A}_{1},{B}_{1},{A}_{2},{B}_{2},....E\right)$ is an if statement, where ${A}_{i}$ are the conditions, ${B}_{i}$ are the matching statements, E is the else part (if there is an odd number of arguments).
 • The expression $\mathrm{&for}\left(\mathrm{VAR},\mathrm{INIT},\mathrm{INCR},\mathrm{FIN},\mathrm{COND},\mathrm{STAT}\right)$ is a for-from statement, where:

 VAR is the variable INIT is the initial value INCR is the increment FIN is the final value COND is the looping condition STAT is the statement sequence

 • If any of VAR, FIN, or STAT is missing, use $\mathrm{&expseq}\left(\right)$ instead.  If there is no looping condition, use true.  Note that break and next are represented by $\mathrm{&break}$ and $\mathrm{&next}$.
 • The expression $\mathrm{&for}\left(\mathrm{VAR},\mathrm{EXPR},\mathrm{COND},\mathrm{STAT}\right)$ is a for-in statement, where:

 VAR is the variable EXPR is the expression COND is the looping condition STAT is the statement sequence

 • If there is no statement sequence, use $\mathrm{&expseq}\left(\right)$ instead.  If there is no looping condition, use true.  Note that break and next are represented by $\mathrm{&break}$ and $\mathrm{&next}$.
 • The strings $\mathrm{&done}$, $\mathrm{&quit}$, and $\mathrm{&stop}$ are all accepted for the quit statement.
 • The strings $\mathrm{&%}$, $\mathrm{&%%}$, and $\mathrm{&%%%}$ represent $%$, $%%$, and $%%%$.
 • The expressions $A&readB$ and $\mathrm{&save}\left(B\right)$ are the read and save statements, where A is a name being saved and B is the file being saved to. The functions $\mathrm{&read}$ and $\mathrm{&save}$ accept any arrangement of arguments that read and save would accept.
 • Any function call can be represented by the $\mathrm{&function}$ function. For example $g\left(1,2\right)$ would be $g&function\left(1&expseq2\right)$.
 • The functions $\mathrm{&ERROR}\left(\right)$ and $\mathrm{&RETURN}\left(\right)$ represent ERROR() and RETURN() or use the above general function call syntax.
 • An unevaluated expression is represented with the $\mathrm{&uneval}$ function. For example $'f'$ would be $\mathrm{&uneval}\left(f\right)$.
 • An unevaluated catenated name is represented by the $\mathrm{&catenate}$ function. For example $a\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}i$ would be $a&catenatei$.
 • A series is represented by the $\mathrm{&series}$ function.
 • A table is represented by the $\mathrm{&table}$ function.
 • The remember table and the hash table part of a table is represented by the $\mathrm{&hashtab}$ function. For example, the remember table of procedure f created $f\left(1\right)≔2$ would be represented by $\left(1=2\right)&hashtab\left(3=4\right)$.
 • If there is no remember table then use $\mathrm{&expseq}\left(\right)$. If there is no description string then use $\mathrm{&expseq}\left(\right)$. If there are no globals then use $\mathrm{&expseq}\left(\right)$.

Examples

Important: The procmake function has been deprecated.  Use the superseding functions ToInert and FromInert instead to translate between Maple expressions and the corresponding inert forms.

 > $b≔\mathrm{&proc}\left(\left[x,y\right],\left[a\right],\left[\mathrm{remember}\right],\left(\left({\mathrm{&local}}_{1}\right)&:=\left({\mathrm{&args}}_{1}+{\mathrm{&args}}_{2}\right)\right)&statseq\left(\mathrm{&RETURN}\left(''\mathrm{gcd}\left({\mathrm{&args}}_{1},{\mathrm{&local`}}_{1}\right)''\right)\right)\right):$
 > $\mathrm{procmake}\left(b\right)$
 ${\mathbf{proc}}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{option}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{remember}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{a}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{a}{:=}{x}{+}{y}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{RETURN}}{}\left({\mathrm{gcd}}{}\left({x}{,}{a}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (1)