Gets the last element of the list. If the list is infinite, it hangs forever.
The source list.
The last element of list if exists.
expect(last(empty())).toStrictEqual(Option.none());expect(last(fromString("hoge"))).toStrictEqual(Option.some("e"));const list = singleton(42);expect(last(list)).toStrictEqual(Option.some(42));expect(last(list.rest())).toStrictEqual(Option.none()); Copy
expect(last(empty())).toStrictEqual(Option.none());expect(last(fromString("hoge"))).toStrictEqual(Option.some("e"));const list = singleton(42);expect(last(list)).toStrictEqual(Option.some(42));expect(last(list.rest())).toStrictEqual(Option.none());
Gets the last element of the list. If the list is infinite, it hangs forever.