Module list.functional.api

This file implements lists as linked lists. A list is either nil or a cons of a head value and a tail sublist. Each element of the list is a pointed pair. In a Typescript-like description :

type Nil = {}
type List<A> = Nil | Pair<A, List<A>>

Here are two different ways to create lists :

import * as L from "./src/utils/list.functional.api.js";

const aList1 = L.cons(1, L.cons(2, L.nil));
anyToString(aList1); // -> (|1, 2|)

const aList2 = [1, 2, 3, 4, 5, 6, 7].reduce((acc, v) => L.cons(v, acc), L.nil);
anyToString(aList2); // -> (|7, 6, 5, 4, 3, 2, 1|)

Index

Variables

Functions