Appends Two Lists using Prolog Source Code
The following code appends two lists
CODE
append([],Y,Y).
append([X|T],Y,[X|R]) :- append(X,Y,R).
RESULT
?- append([a],[b,c],R).
R = [a, b, c]
Yes
Related Articles
- Delete all occurrences of an Element from a List using Prolog Source Code
- Delete the Nth Element from the List using Prolog Source Code
- List Length Function using Prolog Source Code
- List Member Function using Prolog Source Code
- List Merge Function using Prolog Source Code
- MergeSort Function using Prolog Source Code
- Powersort Function using Prolog Source Code
- QuickSort Function using Prolog Source Code
