Iam trying to generate all n-element sublists of a given list n is one of the arguments I have to use enforced backtracking but not getting the idea

Here is some output from a quick example I did:

?- choose(0,[1,2,3],R).
R = [].

?- choose(1,[1,2,3],R).
R = [1] ;
R = [2] ;
R = [3] ;
false.

?- choose(2,[1,2,3],R).
R = [1, 2] ;
R = [1, 3] ;
R = [2, 3] ;
false.

?- choose(3,[1,2,3],R).
R = [1, 2, 3] ;
false.

?- choose(4,[1,2,3],R).
false.

A few days ago someone posted this: What does this code do?

I guess one could also say it helps to answer your question.

That code with length/2 is about all you need.

Answer - Click to remove blur

choose(N,L,Ps) :-
    p(Ps,L),
    length(Ps,N).