]> Repositorios git - scryer-prolog.git/commitdiff
better implementation of list_si/1
authorMarkus Triska <[email protected]>
Tue, 23 Aug 2022 19:21:17 +0000 (21:21 +0200)
committerMark Thom <[email protected]>
Thu, 27 Oct 2022 05:36:07 +0000 (23:36 -0600)
Per discussion in https://github.com/mthom/scryer-prolog/pull/1589.

src/lib/si.pl

index 7fc3a5965de94ff80b2f9ead832d2a9d533a48c1..d697c8a8cbc8a96072e2f5519199dbd12917cd86 100644 (file)
@@ -43,9 +43,15 @@ integer_si(I) :-
 atomic_si(AC) :-
    functor(AC,_,0).
 
-list_si(L) :-
-   \+ \+ length(L, _),
-   sort(L, _).
+% list_si(L) :-
+%    \+ \+ length(L, _),
+%    sort(L, _).
+
+list_si(L0) :-
+   '$skip_max_list'(_,_, L0,L),
+   (  nonvar(L) -> L = []
+   ;  throw(error(instantiation_error, list_si/1))
+   ).
 
 chars_si(Cs) :-
    list_si(Cs),