]> Repositorios git - scryer-prolog.git/commitdiff
ENHANCED: call_nth(Goal, 0) now fails, correct error for N < 0.
authorMarkus Triska <[email protected]>
Mon, 7 Mar 2022 22:38:30 +0000 (23:38 +0100)
committerMarkus Triska <[email protected]>
Mon, 7 Mar 2022 22:38:30 +0000 (23:38 +0100)
This addresses #1307.

src/lib/iso_ext.pl

index e614b1f64f2c3100c8190cacfd73e9b0327953b3..6a1f007aac507133dcb548b03127192a04e8cb4c 100644 (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),