1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
.\"
.\" cook - file construction tool
.\" Copyright (C) 1997 Peter Miller;
.\" All rights reserved.
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
.\"
.\" MANIFEST: User Guide, Functions Library
.\"
.H 1 "Functions Library"
There is a file of functions available to you by using a
.eB
#include "functions"
.eE
line in your cookbook.
The file defines a number of useful functions.
.P
The functions in the file also serve as examples of how you can write
your own functions.
.H 2 Capitalize
The
.I capitalize
function maps all of its arguments into lower case, and then the first
letter of each argument is mapped to upper case. Zero, one or more
arguments may be given.
.H 2 Defined-or-null
The
.I defined-or-null
function may be used to determine if a
variable has been set (on the command line, for example) and
return its value if so, otherwise return the empty list.
.P
This function should only be given one argument - the name of
the variable to look for. Additional arguments will be ignored.
Too few arguments will produce a complaint about the "" variable
being undefined.
.H 2 Defined-or-default
The
.I defined-or-default
function may be used to determine if a
variable has been set (on the command line, for example) and
return its value if so, otherwise return the given default value.
.P
The first argument is the name of the variable to look for.
.P
The second and later arguments (if present) are the default
value to be used if the named variable is not defined. Optional.
.H 2 Repeat
The
.I repeat
function is used to repeatedly call another function,
once for each of the specified arguments. The can be useful
when dealing with functions which do not automaticly accept
argument lists in the form you require.
.P
There are many instances where the repeat function call be used
to elegantly avoid used to the ``loop { loopstop }'' construct.
.P
The first argument is the name of the function you want called.
This function must accept a single argument.
.P
The second and subsequent arguments are argument values to be
passed to the named function, one at a time.
.P
The results of the invocations of the function are accumulated
in the order in which they were calculated. The accumulated
results are returned.
|