I have the predicate m(L,L)
and I want it to return the list that it takes.
The code is this :
m([],[]).
m([H|T],[H|L]) :- m(T,L).
When I try to use it with this example :
m([1,2,3,4,5,6,7,8,9,10],L)
I get this as an answer :
L = [1, 2, 3, 4, 5, 6, 7, 8, 9|...].
(I noticed that if I try it with less elements its ok.) why is this happening and the list is unfinished?
How can I avoid this?
Sorry if its a really stupid question but I've searched the web and I couldn't find any documentation that can help me understand... Thank you!