Question

I have a list such as the below given list. However my goal is to make it like the following list below which does not have an extra list inside of a list.

Given:   [[[[1,0,2,3],[0,1,2,3]],[[2,1,0,3],[0,1,2,3]]]]
Desired:  [[[1,0,2,3],[0,1,2,3]],[[2,1,0,3],[0,1,2,3]]]

I have tried flatten, append and various other predicates cannot seem to accomplish this.

Was it helpful?

Solution

Code:

inner([X], X).

Test:

?- inner([[[[1,0,2,3],[0,1,2,3]],[[2,1,0,3],[0,1,2,3]]]], L).
L = [[[1, 0, 2, 3], [0, 1, 2, 3]], [[2, 1, 0, 3], [0, 1, 2, 3]]].
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top