]> Repositorios git - scryer-prolog.git/commitdiff
remove failing append choicepoint in atom_concat/3 special case (#1893)
authorMark <[email protected]>
Tue, 18 Jul 2023 20:44:02 +0000 (14:44 -0600)
committerMark <[email protected]>
Tue, 18 Jul 2023 20:44:02 +0000 (14:44 -0600)
src/lib/builtins.pl

index 7f19d14871a81a091ec0f75fccd569a28511b96a..983503cbd3120b73beaa78e14d6ba40714ec2fda 100644 (file)
@@ -1559,9 +1559,14 @@ atom_concat(Atom_1, Atom_2, Atom_12) :-
        (  var(Atom_12) ->
           throw(error(instantiation_error, atom_concat/3))
        ;  atom_chars(Atom_12, Atom_12_Chars),
-          lists:append(BeforeChars, AfterChars, Atom_12_Chars),
-          atom_chars(Atom_1, BeforeChars),
-          atom_chars(Atom_2, AfterChars)
+          (  var(Atom_2) ->
+             lists:append(BeforeChars, AfterChars, Atom_12_Chars),
+             atom_chars(Atom_2, AfterChars)
+          ;  atom_chars(Atom_2, AfterChars),
+             lists:append(BeforeChars, AfterChars, Atom_12_Chars),
+             !
+          ),
+          atom_chars(Atom_1, BeforeChars)
        )
     ;  var(Atom_2) ->
        (  var(Atom_12) -> throw(error(instantiation_error, atom_concat/3))