From: Mark Thom Date: Sat, 26 Feb 2022 18:07:38 +0000 (-0700) Subject: fix unexpected error in length/2 (#1303) X-Git-Tag: v0.9.0^2~10 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=d4d135f2a9b736966fa274b7a0c4d907b1e68f06;p=scryer-prolog.git fix unexpected error in length/2 (#1303) --- diff --git a/src/lib/lists.pl b/src/lib/lists.pl index 22ee8d4b..964280d7 100644 --- a/src/lib/lists.pl +++ b/src/lib/lists.pl @@ -54,7 +54,7 @@ length(Xs0, N) :- '$skip_max_list'(M, N, Xs0,Xs), !, ( Xs == [] -> N = M - ; nonvar(Xs) -> var(N), throw(error(resource_error(finite_memory),length/2)) + ; nonvar(Xs) -> var(N), Xs = [_|_], throw(error(resource_error(finite_memory),length/2)) ; nonvar(N) -> R is N-M, length_rundown(Xs, R) ; N == Xs -> throw(error(resource_error(finite_memory),length/2)) ; length_addendum(Xs, N, M)