4.15 Procedure Calls

  • procedure-var();
  • procedure-var( arg-expr [,arg-expr, ...] );

    The procedure call has the effect of calling the procedure procedure-var. A procedure call is done exactly like a function call (see Function Calls). The distinction between functions and procedures is only for the sake of the discussion, GAP does not distinguish between them. So we state the following conventions.

    A function does return a value but does not produce a side effect. As a convention the name of a function is a noun, denoting what the function returns, e.g., Length, Concatenation and Order.

    A procedure is a function that does not return a value but produces some effect. Procedures are called only for this effect. As a convention the name of a procedure is a verb, denoting what the procedure does, e.g., Print, Append and Sort.

    gap> Read( "myfile.g" );   # a call to the procedure Read
    gap> l := [ 1, 2 ];;
    gap> Append( l, [3,4,5] );  # a call to the procedure Append
    

    There are a few exceptions of GAP functions that do both return a value and produce some effect. An example is Sortex which sorts a list and returns the corresponding permutation of the entries (see Sortex).

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000