Monday, July 17, 2023

8. Write a Prolog program to implement append for two lists.

  8. Write a Prolog program to implement append for two lists.

app([],L,L).

app([X|M],N,[X|Q]):-

 app(M,N,Q).



OUTPUT:

app([1,2],[3,4],X).

X = [1, 2, 3, 4]

app([1,2],[],X).

X = [1, 2]

 


No comments:

Post a Comment