|Did you know ...||Search Documentation:|
?- atomic_list_concat([gnu, gnat], ', ', A). A = 'gnu, gnat'
The‘atomwards` transformation is usually called a string join operation in other programming languages.
The SWI-Prolog version of this predicate can also be used to split atoms by instantiating Separator and Atom as shown below. We kept this functionality to simplify porting old SWI-Prolog code where this predicate was called concat_atom/3. When used in mode (-,+,+), Separator must be a non-empty atom. See also split_string/4.
?- atomic_list_concat(L, -, 'gnu-gnat'). L = [gnu, gnat]
Predicate atomic_list_concat/3 is ambiguous for the following call:
?- atomic_list_concat(, /, ''). true. ?- atomic_list_concat([''], /, ''). true.
%% replace_word(+Old, +New, +Orig, -Replaced) is det. % % in Replaced all occurrences of Old in Orig have changed in New. % note it doesn't fail if Old is not found. % replace_word(Old, New, Orig, Replaced) :- atomic_list_concat(Split, Old, Orig), atomic_list_concat(Split, New, Replaced).