]> Repositorios git - scryer-prolog.git/commitdiff
partial_string/3 should accept empty lists (#264)
authorMark Thom <[email protected]>
Fri, 21 Feb 2020 19:55:33 +0000 (12:55 -0700)
committerMark Thom <[email protected]>
Fri, 21 Feb 2020 19:55:33 +0000 (12:55 -0700)
src/prolog/lib/non_iso.pl

index 6c35f7793766b11aea03cf1d39bfebc0f9b387c3..7c7e6dee8e7f89010d1c15570ab3e1ca5fe81d24 100644 (file)
@@ -158,12 +158,13 @@ set_random(Seed) :-
     ).
 
 partial_string(String, L, L0) :-
-    (  String == [] -> throw(error(type_error(list, []), partial_string/3))
+    (  String == [] ->
+       L = L0
     ;  catch(atom_chars(Atom, String),
             error(E, _),
-            throw(error(E, partial_string/3)))
-    ),
-    '$create_partial_string'(Atom, L, L0).
+            throw(error(E, partial_string/3))),
+       '$create_partial_string'(Atom, L, L0)
+    ).
 
 partial_string(String) :-
     '$is_partial_string'(String).