I want to build a list of a list for alternating each other in one list, for example: coon ([[1,4], [2,5], [3,6]], X) should return X = 1, 2,3,4 , 5.6. and there is a condition that each subscriber must have only one length, otherwise he must fail, for example [[q, r, y], [a, e], [c, g, t], X] shouid fail, and the cone ([A, B, C], [q, w, e, r, t, y]) should return only one solution, that is, A = [q, r], B = [w, t], C = [ e, y]. my recent approach.
conns([],[]).
conns([[Head|Tail]|X],[Head|Y]):-
append(X,[Tail],X2),
conns(X2,Y).
conns([[]|T],A):-
conns(T,A).
This gives me some solutions when I try to use coon ([A, B, C], [q, w, e, r, t, y]). I tried the clock to figure it out, but it all failed. How should I return a single list for each list containing the same length? Thank you very much!