Wafl Home

Program Structure Tutorial

Higher Order Functions

One of essential properties of functional programming languages is that functions are treated as first order citizens. Functions can be used as arguments and results of other functions.

In the following simple example, a function is used as argument of another function application. More complex examples follow later.

Source code:

apply(double,2)
where{
    apply(f,x) = f(x);
    double(x) = x + x;    
}

Result:

4

 

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.