how do i flatten a complicate list in prolog?

I have a list, which looks like -> [[[7, 8, 9], [7, 8, 9]]], I want to become follow example,

[[[7,8,9],[7,8,9]]] -> [[7,8,9],[7,8,9]] is this possible?

>Solution :

It is possible:

unpack([Ls], Ls).

e.g.

?- unpack([[[7, 8, 9], [7, 8, 9]]], Answer).
Answer = [[7, 8, 9], [7, 8, 9]]

Leave a Reply