Top
Back: 4.13 proc
Forward: 4.14 qring
FastBack: 4. Data types
FastForward: 5. Functions and system variables
Up: 4.13 proc
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

4.13.1 proc declaration

Syntax:

[static] proc proc_name [parameter_list]
["help_text"]
{
     procedure_body
}
[example
{
     sequence_of_commands;
}]
proc proc_name = proc_name ;
proc proc_name = string_expression ;

Purpose:

defines a new function, the proc proc_name, with the additional information help_text, which is copied to the screen by help proc_name; and the example section which is executed by example proc_name;.
The help_text, the parameter_list, and the example section are optional. The default for a parameter_list is (list #), see Parameter list. The help and example sections are ignored if the procedure is defined interactively, i.e., if it was not loaded from a file by a LIB command.
Specifying static in front of the proc-definition is only possible in a library file and makes this procedure local to the library, i.e., accessible only for the other procedures in the same library, but not for the users.

Example:
 
  proc milnor_number (poly p)
  {
    ideal i= std(jacob(p));
    int m_nr=vdim(i);
    if (m_nr<0)
    {
      "// not an isolated singularity";
    }
    return(m_nr);         // the value of m_nr is returned
  }
  ring r1=0,(x,y,z),ds;
  poly p=x^2+y^2+z^5;
  milnor_number(p);
→ 4

See LIB; Libraries; Procedures.


Top Back: 4.13 proc Forward: 4.14 qring FastBack: 4. Data types FastForward: 5. Functions and system variables Up: 4.13 proc Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.