Prolog list of lists get all elements

前端 未结 1 1578
栀梦
栀梦 2021-01-26 13:18

I have a lists of lists:

decide([[1,2,-3],[-2,3],[6],[4]],K). 

I want to return all the possible solutions pressing \';\'.

The rule is

相关标签:
1条回答
  • 2021-01-26 13:34

    Taking your other question as a starting point, simply insert your new requirements:

    listoflist_member(Xss, X) :-
       ( Xs = [_] ; Xs = [_,_|_] ),           % new
       member(Xs, Xss),
       member(X, Xs).
    
    0 讨论(0)
提交回复
热议问题