Closed brebs-gh closed 3 years ago
As you see, the matches are at different locations. Prolog doesn't know the caller ignores some arguments, so there is no way to handle this differently in the implementation of the predicate. If you need unique answers, distinct/1 or distinct/2 may be the way to go. As is, sub_string/5 is the string equivalent of ISO sub_atom/5 which is defined to work as it does. Please use the forum for further discussion.
In swi-prolog 8.2.4:
More digging shows: