0
|
2390 Views
|
|
2 Total Likes
View groups...
Share
GROUPS:

# Is AppendTo a good approach to making a list of lists?

Posted 11 years ago
 I have lists such as {{1, 1}, {8, 2}, {7, 4}, {1, 1}}then {{8, 2}, {15, 5}, {7, 4}, {8, 2}}then {{18, 4}, {15, 5}, {8, 2}, {18, 4}}I want to create  {{{1, 1}, {8, 2}, {7, 4}, {1, 1}} , {{8, 2}, {15, 5}, {7, 4}, {8, 2}} , {{18, 4}, {15, 5}, {8, 2}, {18, 4}}}I have tried AppendTo first list , second list, then AppendTo result to third list, but get{{1, 1}, {8, 2}, {7, 4}, {1, 1}, {{8, 2}, {15, 5}, {7, 4}, {8, 2}}, {{18, 4}, {15, 5}, {8, 2}, {18, 4}}}which is the wrong nesting. Any ideas?
Sort By:
Posted 11 years ago
 You can just nest them in the top list:In[1]:= lst1 = {{1, 1}, {8, 2}, {7, 4}, {1, 1}};lst2 = {{8, 2}, {15, 5}, {7, 4}, {8, 2}};lst3 = {{18, 4}, {15, 5}, {8, 2}, {18, 4}};{lst1, lst2, lst3}Out[4]= {{{1, 1}, {8, 2}, {7, 4}, {1, 1}}, {{8, 2}, {15, 5}, {7,    4}, {8, 2}}, {{18, 4}, {15, 5}, {8, 2}, {18, 4}}}Best,David
Community posts can be styled and formatted using the Markdown syntax.