The examples directory contains a few small and not so small example programs which illustrate various aspects of the Cool programming language.
-
stack.cl
Implementation of simple stack machine in Cool. -
arith.cl
Tests various aspects of arithmetic in Cool. -
atoi.cl
An implementation of the C function by the same name. It converts a String into an Int. -
atoi_test.cl
An example program using atoi.cl. -
list.cl
A very simple program showing how to create a list data type for integers. It illustrates inheritance and dynamic dispatch. -
book_list.cl
Illustrates inheritance and in particular the mechanism of STATIC DISPATCH and the CASE statement. -
cells.cl
Models a one-dimensional cellular automaton. -
cool.cl
An short and obscure program. -
io.cl
Shows how to use the IO class. (input/output) -
hairyscary.cl
Exercises many of the obscure features of the language in obscure ways. -
hello_world.cl
The classic first program. -
primes.cl
An unusual prime number generator. -
graph.cl
A program reading descriptions of weighted-directed graphs from stdin in text format. -
g1.graph
A sample input to graph.cl -
palindrome.cl
Recognizes palindromes. -
complex.cl
Checks the = operator and cummulative effects of method calls via a complex number object. -
life.cl
The classic Game of Life -
sort_list.cl
A more complex example sorting lists of integers.