procmake - Maple Programming 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(&expseq(a, b)) and &function(f, &expseq(a, b)). 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 indets(&args[-1]). When entering such function calls, it is best to use the &function form, for example, &function(gcd, &expseq(a, b))", 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 &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 &args[0], &args[-1], and &args[-2]. If there are no statements in the procedure, use &expseq().
 • The expression &statseq(A, B, C, ....) is a statement sequence, where A, B, and C are statements.
 • The expression &expseq(A, B, C) is an expression sequence, where A, B, and C are expressions.
 • The empty expression sequence (NULL) is represented by &expseq().
 • The expression &:=(A, B) is an assignment statement, where A is assigned the value of B.
 • The expression &if(A[1], B[1], A[2], B[2], .... E) 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 &for(VAR, INIT, INCR, FIN, COND, STAT) 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 &expseq() instead.  If there is no looping condition, use true.  Note that break and next are represented by &break and &next, respectively.
 • The expression &for(VAR, EXPR, COND, STAT) 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 &expseq( instead.  If there is no looping condition, use true.  Note that break and next are represented by &break and &next, respectively.
 • The strings &done, &quit, and &stop are all accepted for the quit statement.
 • The strings &%, &%%, and &%%% represent %, %%, and %%%, respectively.
 • The expressions &read(A, B) and &save(B) are the read and save statements, where A is a name being saved and B is the file being saved to. The functions &read and &save accept any arrangement of arguments that read and save would accept.
 • Any function call can be represented by the &function function. For example $g\left(1,2\right)$ would be &function(g,&expseq(1,2)).
 • The functions &ERROR() and &RETURN() represent ERROR() and RETURN() or use the above general function call syntax.
 • An unevaluated expression is represented with the &uneval function. For example $'f'$ would be &uneval(f).
 • An unevaluated catenated name is represented by the &catenate function. For example a.i would be &catenate(a,i).
 • A series is represented by the &series function.
 • A table is represented by the &table function.
 • The remember table and the hash table part of a table is represented by the &hashtab function. For example, the remember table of procedure f created using f(1):=2; f(3):=4; would be represented by &hashtab(1=2,3=4).
 • If there is no remember table then use &expseq(). If there is no description string then use &expseq(). If there are no globals then use &expseq().

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(\mathrm{&local}\left[1\right]\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&:=\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(\mathrm{&args}\left[1\right]+\mathrm{&args}\left[2\right]\right)\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&statseq\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left(&RETURN\left(''\mathrm{gcd}\left(\mathrm{&args}\left[1\right],\mathrm{&local}\left[1\right]\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)