procmake - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


procmake

create a Maple procedure

 

Calling Sequence

Parameters

Description

Examples

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, fa,b 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 gcda,b.

• 

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 Ai are the conditions, Bi 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 g1,2 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`&proc`x,y,a,remember,`&local`1&:=`&args`1+`&args`2&statseq&RETURNgcd`&args`1,`&local`1:

procmakeb

procx,yoptionremember;locala;ax+y;RETURNgcdx,aend proc

(1)

See Also

FromInert

procbody(deprecated)

ToInert