I wrote this code for get the leaves of a tree.
leaf([X,[], []], [X]). leaf([_, G, D], N):-leaf(G, N1), leaf(D, N2), mix(N1, N2, N3), N is N3.
bu