Wafl Home

Tuple Tutorial

Tuple Selectors

Tuple elements are accessed by tuple selectors. Because tuple elements are not named, their position is used to select them. Tuple elements positions are enumerated from 1.

Tuple selector uses dot-syntax, with number representing element position, instead of function name:

<tuple>.<n>
<tuple>-><n>

A selector .n is applicable to any tuple having at least n elements. Its type is (Tuple['1 * '2 * ... * 'n] -> 'n).

Source code:

{#1,2,3,4,5#}->f()
where{
    f(t) = {#
        t.1,
        t.1 + t.2,
        t.1 + t.2 + t.3,
        t.1 + t.2 + t.3 + t.4,
        t.1 + t.2 + t.3 + t.4 +t.5
        #};
}

Result:

{# 1, 3, 6, 10, 15 #}

 

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.