Spis treści

Append

Description

Appending two lists

Source: The Art of Prolog

Download

Program source code: append.pl

Listing

/*
	append(Xs,Ys,XsYs) :-
		XsYs is the result of concatening the lists Xs and Ys.
*/
 
	append([],Ys,Ys).
	append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs).
 
%	Program 3.15: Appending two lists

Comments