[ library(lists) | Reference Manual | Alphabetic Index ]
append(+ListOfLists, -LongList)
Concatenate a list of lists
- ListOfLists
- A list of lists
- LongList
- Concatenation of the individual lists
Description
Concatenates (appends) several lists into one long list.
The lists to be concatenated and their order is given as ListOfLists.
If the number or length of the given lists are unknown, the predicate
delays.
Modes and Determinism
Examples
?- append([[a,b],[c],[],[d]], Zs).
Zs = [a, b, c, d]
Yes (0.00s cpu)
?- append([[a,b],c,[d]], Zs).
No (0.00s cpu)
?- append([], Zs).
Zs = []
Yes (0.00s cpu)
?- append([[a]|Bs], Zs).
Bs = Bs
Zs = [a|_177]
Delayed goals:
append(Bs, _177)
Yes (0.00s cpu)
?- append([[a],Bs,[c]], Zs).
Zs = [a|_183]
Delayed goals:
lists : append3(Bs, [c], _183)
Yes (0.00s cpu)
See Also
append / 3, flatten / 3