Lists

In this lesson, we will be introduced to the advanced variant data structure called the list.

The Definition

A list is an immutable data structure which stores homogenous elements (elements of the same type) in sequential form.

The reason it differs from other structures like tuples or arrays is that a list is a polymorphic variant type.

To understand why a list is a variant, we need to look at its structure.

The Structure

As a general convention in Reason, the start of a list is called the head, while the end of the list is known as its tail.

Here is the template for a Reason list:

Get hands-on with 1400+ tech skills courses.