Elucidator Demo

Kurt Normark ©     normark@cs.auc.dk
Aalborg University, Denmark

Abstract.

This is a brief demo example of an Elucidative Program

 

1     Overview

This Elucidative program consists of two tiny source programs: prog1 and prog2. The first of these was used for illustration of SchemeDoc, in terms of a prog1 interface manual.

1.1     Introduction
 


1.1     Introduction

prog1.scm contains the factorial function fac, and 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.

2     Higher-order functions

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.

2.1     Filtering
2.2     Function composition
2.3     Enumeration ordering
 


2.1     Filtering

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, .


2.2     Function composition

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 .


2.3     Enumeration ordering

It is some times useful to be able to generate a 'less-than-or-equal' function from an explicitly given enumeration ordering. This is done by the function generate-leq. Values of the enumeration-order are supposed to occur as constituents of some data structure. The selector function selector accesses the enumertion values within the data structure. Enumeration values are compared using eq-eq?, which is an optional parameter of generate-leq . Notice the pattern used for handling of optional parameters, and in particular the use of the function optional-parameter.

3     Trailing Stuff

In this section we demonstrate a few additional topics

3.1     Inter program references
 


3.1     Inter program references

It is - of course - possible to link applied names in one source program to the defining name in another source file. See the list other-source-list which refers to the defined names in another source program.