Top
Back: proc
Forward: proc expression
FastBack: poly
FastForward: resolution
Up: proc
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

4.18.1 proc declaration

Syntax:
[static] proc proc_name [(<parameter_list>)
[<help_string>]
{
     <procedure_body>
}
[example
{
     <sequence_of_commands>
}]
Purpose:
Defines a new function, the proc proc_name. Once loaded in a SINGULAR session, the information provided in the help string will be displayed upon entering help proc_name;, while the example section will be executed upon entering example proc_name;. See Parameter list, Help string, and the example in Procedures in a library.
The help string, the parameter list, and the example section are optional. They are, however, mandatory for the procedures listed in the header of a library. The help string is ignored and no example section is allowed if the procedure is defined interactively, i.e., if it is not loaded from a file by the LIB or load command (see LIB and see load ).
In the body of a library, each procedure not meant to be accessible by users should be declared static. See Procedures in a library.

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; apply.


Top Back: proc Forward: proc expression FastBack: poly FastForward: resolution Up: proc Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.4.0, 2024, generated by texi2html.