The source list.
The last element of list if exists.
import { empty, fromString, last, singleton } from "./list.ts";
import * as Option from "./option.ts";
import { assertEquals } from "../deps.ts";
assertEquals(last(empty()), Option.none());
assertEquals(last(fromString("hoge")), Option.some("e"));
const list = singleton(42);
assertEquals(last(list), Option.some(42));
assertEquals(last(list.rest()), Option.none());
Generated using TypeDoc
Gets the last element of the list. If the list is infinite, it hangs forever.