source: git/Singular/LIB/template.lib @ 2e7859

fieker-DuValspielwiese
Last change on this file since 2e7859 was 9c5d43, checked in by Olaf Bachmann <obachman@…>, 24 years ago
singular-user git-svn-id: file:///usr/local/Singular/svn/trunk@4184 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.2 KB
Line 
1////////////////////////////////////////////////////////////////////
2// version string automatically expanded by CVS
3version="$Id: template.lib,v 1.5 2000-03-08 15:02:43 obachman Exp $";
4// summary description of the library
5info="
6LIBRARY:   template.lib  A TEMPLATE FOR A SINGULAR LIBRARY
7
8AUTHOR:    Olaf Bachmann, email: obachman@mathematik.uni-kl.de
9
10SEE ALSO:  standard_lib, Guidelines for writing a library,
11           Typesetting of help strings
12
13KEYWORDS: library, template.lib; template.lib; library, info string
14
15PROCEDURES:
16  mdouble(int)           return double of int argument
17  mtripple(int)          return three times int argument
18  msum([int,..,int])     sum of int arguments
19";
20////////////////////////////////////////////////////////////////////
21proc mdouble(int i)
22"USAGE:  mdouble(i); i int
23RETURN:  int: i+i
24NOTE:    Help string is in pure ASCII
25         this line starts on a new line since previous line is short
26         mdouble(i): no new line
27SEE ALSO: msum, mtripple, Typesetting of help strings
28KEYWORDS: procedure, ASCII help
29EXAMPLE: example mdouble; shows an example"
30{
31  return (i + i);
32}
33example
34{ "EXAMPLE:"; echo = 2;
35  mdouble(0);
36  mdouble(-1);
37}
38////////////////////////////////////////////////////////////////////
39proc mtripple(int i)
40"@c we do texinfo here
41@table @asis
42@item @strong{Usage:}
43@code{mtripple(i)}; @code{i} int
44
45@item @strong{Return:}
46int: @math{i+i+i}
47@item @strong{Note:}
48Help is in pure Texinfo
49@*This help string is written in texinfo, which enables you to use,
50among others, the @@math command for mathematical typesetting (like
51@math{\alpha, \beta}).
52@*It also gives more control over the layout, but is, admittingly,
53more cumbersome to write.
54@end table
55@c use @c ref contstuct for references
56@cindex procedure, texinfo help
57@c ref
58@strong{See also:}
59@ref{mdouble}, @ref{msum}, @ref{Typesetting of help strings}
60@c ref
61"
62{
63  return (i + i + i);
64}
65example
66{ "EXAMPLE:"; echo = 2;
67  mtripple(0);
68  mtripple(-1);
69}
70////////////////////////////////////////////////////////////////////
71proc msum(list #)
72"USAGE:  msum([i_1,..,i_n]); @code{i_1,..,i_n} def
73RETURN:  Sum of int arguments
74NOTE:    This help string is written in a mixture of ASCII and texinfo
75         @* Use @code  for typewriter font (like @code{i_1})
76         @* Use @math  for simple math mode typesetting (like @math{i_1}).
77         @* Note: No parenthesis like } are allowed inside @math and @code
78         @* Use @example for indented preformatted text typeset in typewriter
79         font like
80@example
81         this  --> that
82@end example
83        Use @format  for preformatted text typeset in normal font
84@format
85         this --> that
86@end format
87        Use @texinfo for text in pure texinfo
88@texinfo
89@expansion{}
90@tex
91$i_{1,1}$
92@end tex
93
94@end texinfo
95        Notice that
96        automatic linebreaking         is still in affect (like on this line).
97SEE ALSO: mdouble, mtripple, Typesetting of help strings
98KEYWORDS: procedure, ASCII/Texinfo help
99EXAMPLE: example msum; shows an example"
100{
101  if (size(#) == 0) { return (0);}
102  if (size(#) == 1) { return (#[1]);}
103  int i;
104  def s = #[1];
105  for (i=2; i<=size(#); i++)
106  {
107    s = s + #[i];
108  }
109  return (s);
110}
111example
112{ "EXAMPLE:"; echo = 2;
113  msum();
114  msum(4);
115  msum(1,2,3,4);
116}
Note: See TracBrowser for help on using the repository browser.