Merge pull request #1332 from triska/call_nth_0

ENHANCED: call_nth(Goal, 0) now fails, correct error for N < 0.
This commit is contained in:
Mark Thom
2022-03-07 15:16:47 -07:00
committed by GitHub

View File

@@ -203,8 +203,11 @@ partial_string_tail(String, Tail) :-
call_nth(Goal, N) :- call_nth(Goal, N) :-
can_be(integer, N), can_be(integer, N),
( integer(N), N =< 0, ( integer(N) ->
domain_error(positive_integer, N, call_nth/2) ( N < 0 ->
domain_error(not_less_than_zero, N, call_nth/2)
; N > 0
)
; true ; true
), ),
setup_call_cleanup(call_nth_nesting(ID), setup_call_cleanup(call_nth_nesting(ID),