From: Markus Triska Date: Fri, 26 Nov 2021 16:11:51 +0000 (+0100) Subject: use must_be(list, ...) earlier, since it is now faster X-Git-Tag: v0.9.0~22^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=803e120a5108048bbab10872b4f2933f113c361b;p=scryer-prolog.git use must_be(list, ...) earlier, since it is now faster --- diff --git a/src/lib/error.pl b/src/lib/error.pl index 749ad04e..d5827495 100644 --- a/src/lib/error.pl +++ b/src/lib/error.pl @@ -47,13 +47,13 @@ must_be_(integer, Term) :- check_(integer, integer, Term). must_be_(atom, Term) :- check_(atom, atom, Term). must_be_(character, T) :- check_(error:character, character, T). must_be_(chars, Ls) :- - ( ground(Ls), '$is_partial_string'(Ls) -> + must_be(list, Ls), + ( '$is_partial_string'(Ls) -> % The expected case (success) uses a very fast test. % We cannot use partial_string/1 from library(iso_ext), % because that library itself imports library(error). true - ; must_be(list, Ls), - all_characters(Ls) + ; all_characters(Ls) ). must_be_(list, Term) :- check_(error:ilist, list, Term). must_be_(type, Term) :- check_(error:type, type, Term).