Top
Back: Names in procedures
Forward: Procedure commands
FastBack: Input and output
FastForward: Libraries
Up: Procedures
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

3.7.3 Parameter list

Syntax:
( )
( parameter_definition )
Purpose:
defines the number, type and names of the arguments to a proc.
The parameter_list is optional. The default for a parameter_list is (list #) which means the arguments are referenced by #[1], #[2], etc.
Example:
 
proc x0
{
    // can be called with
... // any number of arguments of any type: #[1], #[2],...
    // number of arguments: size(#)
}

proc x1 ()
{
... // can only be called without arguments
}

proc x2 (ideal i, int j)
{
... // can only be called with 2 arguments,
    // which can be converted to ideal resp. int
}

proc x3 (i,j)
{
... // can only be called with 2 arguments
    // of any type
    // (i,j) is the same as (def i,def j)
}

proc x5 (i,list #)
{
... // can only be called with at least 1 argument
    // number of arguments: size(#)+1
}

Note:

The parameter_list may stretch across multiple lines.
A parameter may have any type (including the types proc and ring). If a parameter is of type ring, then it can only be specified by name, but not with a type, e.g.
 
proc x6 (r)
{
... // this is correct even if the parameter is a ring
}

proc x7 (ring r)
{
... // this is NOT CORRECT
}


Top Back: Names in procedures Forward: Procedure commands FastBack: Input and output FastForward: Libraries Up: Procedures Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 3-0-1, October 2005, generated by texi2html.