| | Generated: December 9, 2003, 14:02:51 |
The program prog2
Kurt Nørmark ©
Source file: c:/users/kurt/scheme/examples/tutorial/schemedoc/prog2.scm
LAML Version 22.00 (December 6, 2003, alpha-6) This is a Scheme file with a few simple functions.
The functions are written and organized with the purpose
of demonstrating the LAML SchemeDoc tool.
Table of Contents: Alphabetic index: 1 The fac and fib functions. |
|
|
fac |
Form | (fac n) |
Description | Calculate the factorial of n. |
Precondition | The integer must be non-negative. |
Parameters | n | An integer |
Returns | n! |
|
fib |
Form | (fib n) |
Description | Calculated the fib function.
Notice that this is a very inefficient
implementation. |
Precondition | The integer must be non-negative. |
Parameters | n | An integer |
Returns | The n't fiabonaci number. |
|
2 A couple of higher order function. |
These functions are useful in many situations. |
|
negate |
Form | (negate p) |
Description | A higher order functions which negates the predicate p.
Negate accepts a predicate and returns the negated predicate. |
Parameters | p | a predicate - p: type -> boolean for any type. |
Returns | A predicate that returns the negated value. Thus (not ((negate p) x)) = (p x) for all x. |
|
compose |
Form | (compose f g) |
Description | A higher order function that composes two functions.
Returns a function which applies f on g.
Both f and g are supposed to take a single argument. |
Parameters | f | A function of a single parameter. |
g | A function of a singe parameter. |
Returns | f ° g |
|
3 List selector functions. |
The functions in this category are alternatives for car, cadr, etc. |
|
first |
Form | (first lst) |
Description | Return the first element of a list |
Parameters | lst | A list |
Returns | the first element of the list |
|
second |
Form | (second lst) |
Description | Return the second element of a list |
Parameters | lst | A list |
Returns | the second element of the list |
|
Generated: December 9, 2003, 14:02:51
This documentation has been extracted automatically from the Scheme
source file by means of the Schemedoc tool