ENHANCED: call_nth(Goal, 0) now fails, correct error for N < 0.

This addresses #1307.
This commit is contained in:
Markus Triska
2022-03-07 23:38:30 +01:00
parent bd594e0c05
commit 69e52d1ed8

View File

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