I’d like an easy way to identify the end of a list, where the list might be closed, open or involve coroutining. If the list is open, it should be kept open. Example:
Lst = [a|Gotcha], freeze(Gotcha, Gotcha = [b,c|Tail]).
The end of Lst
is Tail
. Because of the freeze, ==
is insufficient, and unification would unintentionally close an open list.
I thought I was being clever in using:
\+ \+ Elem = []
… which is not tricked by Gotcha
. But, false disapproves, so I’m back to questioning my understanding of reality.
Are mere mortals meant to use '$skip_list'(Length, List, Tail)
(as seen in library), given its lack of documentation?