The list to be un-constructed.
The optional of the pair of head and rest.
import { List, empty, unCons, singleton } from "./list.ts";
import * as Option from "./option.ts";
import { assertEquals } from "../deps.ts";
assertEquals(unCons(empty()), Option.none());
assertEquals(
unCons(singleton(42)),
Option.some([42, empty()] as [number, List<number>]),
);
Generated using TypeDoc
Makes the list into an
Option
having head and rest.