From: Markus Triska Date: Mon, 7 Mar 2022 22:38:30 +0000 (+0100) Subject: ENHANCED: call_nth(Goal, 0) now fails, correct error for N < 0. X-Git-Tag: v0.9.1~124^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=69e52d1ed80d9bdc33ea1d646f816953e1ac3cdf;p=scryer-prolog.git ENHANCED: call_nth(Goal, 0) now fails, correct error for N < 0. This addresses #1307. --- diff --git a/src/lib/iso_ext.pl b/src/lib/iso_ext.pl index e614b1f6..6a1f007a 100644 --- a/src/lib/iso_ext.pl +++ b/src/lib/iso_ext.pl @@ -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),