use new predicates from library(error) to throw type and domain errors

This commit is contained in:
Markus Triska
2020-04-28 17:34:56 +02:00
parent 97115a9c1c
commit b139620fba
3 changed files with 13 additions and 13 deletions

View File

@@ -21,9 +21,9 @@ length(Xs, N) :-
; var(Xs0) -> R is N-M, length_rundown(Xs0, R)).
length(_, N) :-
integer(N), !,
throw(error(domain_error(not_less_than_zero, N), length/2)).
domain_error(not_less_than_zero, N, length/2).
length(_, N) :-
throw(error(type_error(integer, N), length/2)).
type_error(integer, N, length/2).
length_addendum([], N, N).
length_addendum([_|Xs], N, M) :-