The source list.
The reversed list.
import { empty, fromArray, fromString, reverse, toArray } from "./list.ts";
import { assertEquals } from "../deps.ts";
assertEquals(reverse(empty()), empty());
assertEquals(toArray(reverse(fromArray([1, 4, 2, 3]))), [3, 2, 4, 1]);
assertEquals(toArray(reverse(fromString("hoge"))), ["e", "g", "o", "h"]);
Generated using TypeDoc
Reverses the list. If the list is infinite, it will hang forever.