Tuple

Imports
open Array;
Table of Contents

Types

Tuple

(type)
type Tuple

Functions

new

Creates a new tuple from two values.
def new (x: a) (y: b) : Tuple

fst

Returns the first element of the tuple.
def fst (t: Tuple) : a

snd

Returns the second element of the tuple.
def snd (t: Tuple) : b

swap

Swaps the elements of the tuple.
def swap (t: Tuple) : Tuple

map_fst

Maps a function over the first element of the tuple.
def map_fst (f: (a : t) -> c) (t: Tuple) : Tuple

map_snd

Maps a function over the second element of the tuple.
def map_snd (f: (b : t) -> c) (t: Tuple) : Tuple

to_list

Converts a tuple to a list.
def to_list (t: Tuple) : Array a

eq

Checks if two tuples are equal.
def eq (t1: Tuple) (t2: Tuple) : Bool

length

Returns the length of the tuple.
def length (t: Tuple) : Int