Append(?List1, ?List2, ?List3) - ECLiPSe-CLP
Maybe your like
[ library(lists) | Reference Manual | Alphabetic Index ] append(?List1, ?List2, ?List3) Succeeds if List3 is the result of appending List2 to List1. ?List1 List or variable. ?List2 List or variable. ?List3 List or variable.
Description
Unifies List3 to the result of appending List2 to List1. On backtracking append/3 gives all possible solutions for List1 and List2, if both are uninstantiated.The definition of this Prolog library predicate is: append([],X,X). append([X|L1],L2,[X|L3]):- append(L1,L2,L3). This predicate does not perform any type testing functions.
Modes and Determinism
- append(+, +, -) is det
- append(-, -, +) is multi
Fail Conditions
Fails if List3 does not unify with the result of appending List2 to List1.Resatisfiable
Yes.Examples
Success: append([1,2],L2,[1,2,3,4]). (gives L2=[3,4]). append([1,B],L2,[A,2,3,4]). (gives B=2 L2=[3,4] A=1). append([1,2],L2,L3). (gives L2=L2 L3=[1,2|L2]). append([1],[2,3],L3). (gives L3=[1,2,3]). [eclipse]: append(L1,L2,[1,2]), writeln((L1,L2)), fail. [] , [1, 2] [1] , [2] [1, 2] , [] no (more) solution. Fail: append(L1,[3],[1,2,3,4]). append(1,L2,[1,2]).See Also
union / 3Tag » Add Element In List In Prolog
-
How Do You Append An Element To A List In Place In Prolog?
-
SWI-Prolog -- Append/3
-
Learn How Does Append Work In Prolog - EduCBA
-
Prolog - Lists - Tutorialspoint
-
6.1 Append - Learn Prolog Now!
-
Prolog - List Operations Append - YouTube
-
[PDF] Lists In Prolog
-
Lists - Prolog Tutorial
-
Instantly Share Code, Notes, And Snippets. - Gists · GitHub
-
How Do You Append An Element To A List In Place In Prolog
-
Lists In Prolog - GeeksforGeeks
-
Prolog - How Do You Insert An Element To A List - Copy Programming
-
[PDF] Prolog Lecture 5
-
Lists And Recursion - sual
-
Append Element To Beginning Of List In Prolog
-
Lists
-
List Processing - GNU Prolog
-
Using Lists - AI Study
-
[PDF] 10 Difference Lists