projog

3.103. atomic_list_concat(List,Separator,Atom) / atomic_list_concat(List,Atom)

Concatenates the elements of List and attempts to unify with Atom. If using the 3 argument version then Separator will be inserted between each element of List.

Examples

?- atomic_list_concat([a,b,c], abc).

yes

?- atomic_list_concat([a,b,c], xyz).

no

?- atomic_list_concat([a,b,c], X).
X = abc

yes

?- atomic_list_concat([a,b,c], -, 'a-b-c').

yes

?- atomic_list_concat([a,b,c], 'x-y-z').

no

?- atomic_list_concat([a,b,c], -, X).
X = a-b-c

yes

?- atomic_list_concat(X, -, 'a-b-c').
X = [a,b,c]

yes

?- atomic_list_concat([X,Y,Z], -, 'a-b-c').
X = a
Y = b
Z = c

yes

?- atomic_list_concat([X,Y,Z], -, '6-12-9'), atom(X), atom(Y), atom(Z).
X = 6
Y = 12
Z = 9

yes

?- atomic_list_concat([], '').

yes

?- atomic_list_concat([''], -, '').

yes

?- atomic_list_concat(['1','2','3'], '123').

yes

?- atomic_list_concat(['1','2','3'], 123).

no

?- atomic_list_concat([Y], X).

Expected an atom but got: VARIABLE with value: Y

?- atomic_list_concat([1], X).

Expected an atom but got: INTEGER with value: 1

?- atomic_list_concat([p(a)], X).

Expected an atom but got: STRUCTURE with value: p(a)

?- atomic_list_concat([[a]], X).

Expected an atom but got: LIST with value: .(a, [])

?- atomic_list_concat([Y], -, X).

Expected an atom but got: VARIABLE with value: Y

?- atomic_list_concat([1], -, X).

Expected an atom but got: INTEGER with value: 1

?- atomic_list_concat([p(a)], -, X).

Expected an atom but got: STRUCTURE with value: p(a)

?- atomic_list_concat([[a]], -, X).

Expected an atom but got: LIST with value: .(a, [])

?- atomic_list_concat([a], Y, X).

Expected an atom but got: VARIABLE with value: Y

?- atomic_list_concat([a], 1, X).

Expected an atom but got: INTEGER with value: 1

?- atomic_list_concat([a], p(a), X).

Expected an atom but got: STRUCTURE with value: p(a)

?- atomic_list_concat([a], [a], X).

Expected an atom but got: LIST with value: .(a, [])