IF Computer > MINERVA > Manual > Reference > Predicates > Lists > append/3

append/3

MINERVA
ifcomputer logo
f
Expert Services on the Web

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.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/lists/append/print_en.html
published 2008/12/1 update 2001/2/7 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS