Concatenation of Lists in Prolog

前端 未结 4 655
失恋的感觉
失恋的感觉 2021-01-11 10:16

Can someone help me find the error in these rules?

concat([], List, List).
concat([Head|[]], List, [Head|List]).
concat([Head|Tail], List, Concat) :- concat(         


        
4条回答
  •  不知归路
    2021-01-11 10:32

    It can be done by using append.

    concatenate(List1, List2, Result):-
       append(List1, List2, Result).
    

    Hope this helps.

提交回复
热议问题