append/3

Joins or splits arbitrary lists:

append(First,Second,Whole) -(i,i,o),(i,o,i),(o,i,i),(i,i,i),(o,o,i)

?First <list> or <variable>

?Second <list> or <variable>

?Whole <list> or <variable>

Compatibility: LPA Win-Prolog.

Remarks:

1) This predicate succeeds when Whole is bound to a list consisting of the Second list appended to the First list. Any of the arguments may be fully or partially instantiated lists, or simply variables; append/3 can backtrack to generate alternative solutions where appropriate.

2) This predicate is a part of most standard Prolog libraries, but it is usually not a built-in Predicate. However, it is very frequently used, and the G.I.S. Prolog internal implementation is more efficient than any external source-code for this predicate. Some Prolog compilers (e.g. LPA Win-Prolog) also contain append/3 as a built-in predicate. For these reasons, it was decided to implement it as a built-in predicate of G.I.S. Prolog.

See Also member/2.