This is a brief demo example of an Elucidative Program
This Elucidative program consists of two tiny source programs: prog1 and prog2. The first of these was used for illustration of Schemdoc, in terms of a prog1 interface manual.
prog1.scm contains the factorial function fac, and the the two functions head and tail, which are aliases of car and cdr.
prog2.scm shows a collection of classical higher-order functions, compose, filter, and zip.
In this section we explain some details of the higher-order functions, namely filter and compose. We do not go into the details of zip, however.
The function filter makes use of the tail-recursive function, filter-help, which iteratively carries out the filtering. Due to use the iterative processing in filter-help, we need to reverse the result in filter, .
Composition of two or more functions can be done by the function compose. The function handles two special cases first, namely the trivial composition of a single function , the typical composition of two functions
, and composition of more than two functions
.