next up previous
Next: Expressions Up: CCL The Computation and Previous: Introduction

Values

CCL supports the following types

unit boolean integer
real (floating point) string list
record abstract functions (lambda) external functions

Lists are homogeneous: All elements of a given list must have the same type. Here is an example program that demonstrates the different types:

// booleans
true;
false;

// integers
1;
2;

// reals
1.0;
3.1415927E-2;

// strings
"abcdefg\n";

// lists
{ 1, 2, 3, 4 };
{ "a", "b", "c" };
{};

// records
[ x := 5, y := {}, z := "ccl is cool!" ];

// the identity function
lambda x . x;

// you can also write the above as
\ x . x;
More interesting expressions are covered in the next section. External functions are covered later as well (print and exit are examples). Remember that expressions appearing outside a program, terminated by a semicolon, are evaluated as they are encountered by ccli and ccli prints each expression and its valuation. Thus, the output of the above program will look a bit repetitive. Also note that lines beginning with ``//'' are treated as comments. Comments may also appear between ``/*'' and ``*/'' as in C.

The ``unit'' type is reserved for external functions that do not return values. Don't worry about it for now.



Eric Klavins 2003-12-03