How can I use findall function in another function, I mean
subset(0, [], []).
subset(Len, [E|Tail], [E|NTail]):- succ(PLen, Len),(PLen > 0 -> subset(PLen, Tail, NTail) ; NTail=[]).
subset(Len, [_|Tail], NTail):- subset(Len, Tail, NTail).
This gives sublist of a list with N elements but I want to keep all result in a list,then I wrote
result(N,List,Result):- findall3(Y,subset(N,List,Y),Result).
Howewer I get error, I am new in prolog, is this usage allowed or not, if not how can I obtain these sublist in a list, is there anyway?
findall3? It's reallyfindall/3which means it is calledfindalland takes 3 arguments. - lurker