Prolog SWI.
Let's say I have a recursive function that adds X items to list in every iteration. Something that looks like:
func(...,BigList):-
func2(...,CurrentList),
BigList = [ CurrentList | Tail ],
func(..., Tail).
I tried to remove parts which are not important, to make it easier to read.
I'll explain: func is suppose to add some items to BigList. In every iteration, func2 initializes CurrentList, which is being added to BigList.
The problem is that BigList looks like:
[[iter1item1,iter1item2,...,iter1itemX],[iter2item1,iter2item2,...,iter2itemX],..[iterXitem1,iterXitem2,...iterXitemX]]
Instead of:
[iter1item1,iter1item2,...,iter1itemX,iter2item1,iter2item2,...,iter2itemX,..iterXitem1,iterXitem2,...iterXitemX]
I'll just say that it might be a simple solution, but I'm new to Prolog, and 20 minuts of Googling didn't really help. I recognize the problem but have no idea how I suppose to write the code such that it will work as I want it to.