This module is inspired by SQL query options such as TOP. Providing such a module was recently pioneered by SWI-Prolog. Currently predicates limit/2 and offset/2 are provided. The predicates solely work tuple oriented and it is possible to cascade these predicates:Example:
?- limit(5, offset(3, between(1, 10, X))).
X = 4 ;
X = 5 ;
X = 6 ;
X = 7 ;
X = 8
The current implementation is based on call_nth/2, which is also
provided through this module. call_nth/2 is in turn implemented
with pivots, an alternative to nb_setarg/3 which does not destruct
a Prolog term, but instead a Java object.
The following sequence predicates are provided: