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!
The list is finished - the output is just getting truncated for visualization purposes. If you write a predicate that prints out your list, you'll see that it's complete. I'm guessing you're using SWI prolog, which means you can check out this link for ways to change the display settings.