Your choices
Your choice of predicate is as follows:
Two concatenable terms as input (can split)
- atom_concat/3 (ISO)
- string_concat/3
Two more general concatenable terms as input (cannot split because arguments 1 and 2 are too general)
A list of concatenable terms as input (never split)
- atomic_list_concat/2 - generates atom at argument 2. Refuses string at argument 2 in accept mode (that's likely a bug).
- atomics_to_string/2 - generates string at argument 2. Refuses atom at argument 2 in accept mode (that's likely a bug).
A list of concatenable terms as input, and intersperse another string (can split at interspersed string)
- atomic_list_concat/3 - concatenate with separator ("intersperse", "join"). Refuses string at argument 3 in accept mode (that's likely a bug).
- atomics_to_string/3 - concatenate with separator ("intersperse", "join"). Refuses atom at argument 3 in accept mode (that's likely a bug).
Examples
?- atomics_to_string([],S). S = "".
?- atomics_to_string([a,b,c],S). S = "abc".
?- atomics_to_string([a,1,c],S). S = "a1c".
Integers stay integers and aren't mapped to chars:
?- atomics_to_string([a,"b",122,0'f,d],X). X = "ab122102d".
Verifying:
?- atomics_to_string([a,b,c],"abc"). true.
atomics_to_string/2 insists on seeing a string at argument 2 place:
?- atomics_to_string([a,b,c],'abc'). false.
It doesn't break a string apart:
?- atomics_to_string(X,"abc"). ERROR: Arguments are not sufficiently instantiated
No flattening:
?- atomics_to_string([a,[b,c],d],"abc"). ERROR: Type error: `text' expected, found `[b,c]' (a list)