Wafl Home

Program Structure Tutorial

Local Definitions

Local definitions include both local expression definitions and local function definitions. All local definitions are introduced including where expressions.

A where expression consists of a main expression body and a block of local definitions. It has the following syntax:

<main-expression>
where {
    <definition>
    <definition>
    ...
}

Local expression definition has the form:

<name> = <expression>

Local function definition has the form:

<name>(<arguments>) = <expression>

The expression of a local definition can contain references to its own arguments and names defined at the same level and less-locally in the code. The order of ocal definitions is not important.

The where expression may reference its local definitions names.

Source code:

add( 'a', something )
where{
    something = add( 'x', 'y' );
    add(x,y) = x + y;
}

Result:

"axy"

 

Table of Contents

Let's Start

Program Structure

Primitive Data Types

List

Tuple

Record

HTML

Command Line Interpreter

Using Web Servers

Syntax

Examples

Tips

The most of examples evaluates with both command line and Web server Wafl interpreters. If any example is based on specific features of an interpreter, it is explicitly annotated.