Pregunta

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.

¿Fue útil?

Solución

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]]].
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top