Introduction
This directory contains a number of simple Timber examples.
In addition to the pages that describe the programs and comment on
the code, the source files are here and can be compiled and run.
Module Echo is stored in file Echo.t and is compiled
and linked by the shell command
timberc --make Echo
which produces an executable file called Echo which can be
run by the command
./Echo
This is generalized in the expected way to other programs; in
particular, the --make option makes sure that all
(recursively) imported modules are compiled in the proper order
before linking is done.
Some programs require a command line argument as described in the
respective page.
A brief summary of the programs is the following:
- Echo. The archetypical reactive program: user input is
read line by line and echoed to the screen.
- Counter. The quintessential stateful class; its instances
maintain an integer value that can be increased and decreased.
- Echo2. Slight extension of Echo: the output
lines are decorated with line numbers, thus adding state to the
root definition.
- Echo3. Another extension: The last input line is
repeatedly echoed once per second, showing use of Timber time
constructs.
- EchoServer. Still a variation: Echoing user input
over the Internet.
- EchoServer2. A variation of the previous: limiting
the number of concurrently served clients.
- Reflex. A simple reaction time tester.
- MasterMind. A bit more complex: The user chooses a
secret in MasterMind and the program does the guessing.
- Primes. As a reactive program, a quite degenerate example:
the program computes the primes up to a given bound and terminates.