Wafl Home

Record Tutorial

Record

Record is structured data type consisted of name-value pairs. While single record may consist of elements of different types, the type of each element is fixed.

Record data type is written as Record[<name1>:<el1-type>, <name2>:<el2-type>, ..., <namen>:<eln-type>].

Record literals begin by { and end by }, with elements separated by commas or semicolons. Record may not be empty.

Braces are used not only for literal record specification, but also as a record construction operator.

Several records are presented in the following example, with their types described in comments.

Source code:

// Record[
//   fst: Record[a:Integer],
//   scd: Record[i:Integer, 
//               s: String, 
//               trd:Record[nme:String, lst:List[Integer]]]
//   ]
{
    fst: { a:1 }, 
    scd: { i:1, s:'a', trd:{ nme:'list', lst:[1,2,3] }}
}

Result:

{ fst:{ a:1 }; scd:{ i:1; s:"a"; trd:{ lst:[1,2,3]; nme:"list" } } }

 

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.