Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

make a list with lists

Status
Not open for further replies.

pascalxricher

Programmer
Oct 22, 2001
14
0
0
CA
Hi !

I need to take a list like that : [ [ [1, 2], [3, 4] ], [ [5, 6], [7, 8] ] ] and this list must become :

[ [1, 2], [3, 4], [5, 6], [7, 8] ]

I know the concept that recursively I'll add element in an other list but I don't know how to implement it...

Anybody can help me ?!

Thanks,
Pascal ;
 
Try this with some modification.

shuffle([],L,L).
shuffle([X|Y],[M|N],[X,M|T]):-shuffle(Y,N,T),!.
shuffle([X|Y],[],[X|T]):-shuffle(Y,[],T).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top