?- 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]