Concatenation of Lists in Prolog

前端 未结 4 653
失恋的感觉
失恋的感觉 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:51

    Here is the concatenation between two lists rule:

    concat([],L2,L2). concat([Head|Tail],L2,[Head|L3]) :- concat(Tail,L2,L3). 
    

提交回复
热议问题