| appends two lists to a third one.
append(?FirstList, ?SecondList, ?ThirdList)
append/3 retrieves by backtracking all lists such that
the concatenation of FirstList with SecondList results in ThirdList.
Arguments
FirstList list
SecondList list
ThirdList list
Examples
| append(X,Y,Z). |
Succeeds with substitution X <- [], Y <- _1, Z <- _1. |
| append([l,i],[s,t],X). |
Succeeds with substitution X <- [l,i,s,t]. |
| append(X,Y,[a,b]).
| Succeeds three times with substitution
X <- [], Y <- [a,b],
X <- [a], Y <- [b], X <- [a,b], Y <- []. |
| append([a,b],X,Y). |
Succeeds with substitution X <- _345, Y <- [a,b|_345]. |
| append([a,b],f(y),Z). |
Succeeds with substitution Z <- [a,b|f(y)]. |
Standard
This predicate is not part of the ISO-Prolog Standard.
See also
member/2,
reverse/2/3,
sort/2.
merge_sort/2.
|