Documentation Prolog Predicate Reference lists nth0/4


Get the Nth element of a list and the rest of elements on it.


nth0( ?integer, ?list, ?term, ?list )

nth0(Index, List, Item, Rest) is true if and only if Item is the element of List on the Index-th position and Rest is a new version of List which does not contain Item. nth0 starts the index count at 0.