Flattening the sub-lists [closed]Remove elements at certain positions from all sub-lists?How to group lists that own one common element?Searching linked lists that contain lists?Partition list into a given number of sub-listsHow to plot specific listsList of (sub-)lists - query sub-lists by names?How to efficiently Flatten nested lists while preserving select levels?Flattening large list of listsDeleting sub-list that contains duplicatesSpeed up Flatten[] of a large nested list
Causes of bimodal distributions when bootstrapping a meta-analysis model
Is there an official reason for not adding a post-credits scene?
Emotional immaturity of comic-book version of superhero Shazam
Understanding trademark infringements in a world where many dictionary words are trademarks?
Upside-Down Pyramid Addition...REVERSED!
Why are prions in animal diets not destroyed by the digestive system?
Why aren't nationalizations in Russia described as socialist?
What does this wavy downward arrow preceding a piano chord mean?
How to write a 12-bar blues melody
Wrong answer from DSolve when solving a differential equation
Out of scope work duties and resignation
Gerrymandering Puzzle - Rig the Election
My advisor talks about me to his colleague
Should I mention being denied entry to UK due to a confusion in my Visa and Ticket bookings?
What to use instead of cling film to wrap pastry
Where is the documentation for this ex command?
Appropriate certificate to ask for a fibre installation (ANSI/TIA-568.3-D?)
Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?
ZSPL language, anyone heard of it?
Are pressure-treated posts that have been submerged for a few days ruined?
How do LIGO and VIRGO know that a gravitational wave has its origin in a neutron star or a black hole?
29er Road Tire?
How can I support myself financially as a 17 year old with a loan?
What does "Managed by Windows" do in the Power options for network connection?
Flattening the sub-lists [closed]
Remove elements at certain positions from all sub-lists?How to group lists that own one common element?Searching linked lists that contain lists?Partition list into a given number of sub-listsHow to plot specific listsList of (sub-)lists - query sub-lists by names?How to efficiently Flatten nested lists while preserving select levels?Flattening large list of listsDeleting sub-list that contains duplicatesSpeed up Flatten[] of a large nested list
$begingroup$
Is there a way to flatten the sub-lists within a list?
Transform
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
Into
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I know I can do
Flatten /@ 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I am wondering whether there are some dedicated functions for such sub-list flattening?
list-manipulation
$endgroup$
closed as off-topic by MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey Apr 26 at 20:14
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey
add a comment |
$begingroup$
Is there a way to flatten the sub-lists within a list?
Transform
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
Into
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I know I can do
Flatten /@ 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I am wondering whether there are some dedicated functions for such sub-list flattening?
list-manipulation
$endgroup$
closed as off-topic by MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey Apr 26 at 20:14
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey
3
$begingroup$
tryFlatten[list,1]
$endgroup$
– J42161217
Apr 25 at 0:55
1
$begingroup$
One can also consider usingJoin @@ yourlist
.
$endgroup$
– Αλέξανδρος Ζεγγ
Apr 25 at 3:27
add a comment |
$begingroup$
Is there a way to flatten the sub-lists within a list?
Transform
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
Into
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I know I can do
Flatten /@ 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I am wondering whether there are some dedicated functions for such sub-list flattening?
list-manipulation
$endgroup$
Is there a way to flatten the sub-lists within a list?
Transform
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
Into
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I know I can do
Flatten /@ 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
I am wondering whether there are some dedicated functions for such sub-list flattening?
list-manipulation
list-manipulation
edited Apr 25 at 0:54
m0nhawk
2,92711532
2,92711532
asked Apr 25 at 0:52
bakerbaker
463
463
closed as off-topic by MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey Apr 26 at 20:14
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey
closed as off-topic by MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey Apr 26 at 20:14
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, m_goldberg, Henrik Schumacher, happy fish, bbgodfrey
3
$begingroup$
tryFlatten[list,1]
$endgroup$
– J42161217
Apr 25 at 0:55
1
$begingroup$
One can also consider usingJoin @@ yourlist
.
$endgroup$
– Αλέξανδρος Ζεγγ
Apr 25 at 3:27
add a comment |
3
$begingroup$
tryFlatten[list,1]
$endgroup$
– J42161217
Apr 25 at 0:55
1
$begingroup$
One can also consider usingJoin @@ yourlist
.
$endgroup$
– Αλέξανδρος Ζεγγ
Apr 25 at 3:27
3
3
$begingroup$
try
Flatten[list,1]
$endgroup$
– J42161217
Apr 25 at 0:55
$begingroup$
try
Flatten[list,1]
$endgroup$
– J42161217
Apr 25 at 0:55
1
1
$begingroup$
One can also consider using
Join @@ yourlist
.$endgroup$
– Αλέξανδρος Ζεγγ
Apr 25 at 3:27
$begingroup$
One can also consider using
Join @@ yourlist
.$endgroup$
– Αλέξανδρος Ζεγγ
Apr 25 at 3:27
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
You are doing redundant step with /@
, Flatten
can make this directly:
Flatten[1, x, 2, x, 3, x, 4, x, 5,
x, 6, x, 7, x, 8, x, 9, x, 10, x, 1]
(* 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8,
x, 9, x, 10, x *)
$endgroup$
add a comment |
$begingroup$
Yes, there is a built-in function for what you want to do.
data = 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x;
Catenate @ data
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
$endgroup$
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You are doing redundant step with /@
, Flatten
can make this directly:
Flatten[1, x, 2, x, 3, x, 4, x, 5,
x, 6, x, 7, x, 8, x, 9, x, 10, x, 1]
(* 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8,
x, 9, x, 10, x *)
$endgroup$
add a comment |
$begingroup$
You are doing redundant step with /@
, Flatten
can make this directly:
Flatten[1, x, 2, x, 3, x, 4, x, 5,
x, 6, x, 7, x, 8, x, 9, x, 10, x, 1]
(* 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8,
x, 9, x, 10, x *)
$endgroup$
add a comment |
$begingroup$
You are doing redundant step with /@
, Flatten
can make this directly:
Flatten[1, x, 2, x, 3, x, 4, x, 5,
x, 6, x, 7, x, 8, x, 9, x, 10, x, 1]
(* 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8,
x, 9, x, 10, x *)
$endgroup$
You are doing redundant step with /@
, Flatten
can make this directly:
Flatten[1, x, 2, x, 3, x, 4, x, 5,
x, 6, x, 7, x, 8, x, 9, x, 10, x, 1]
(* 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8,
x, 9, x, 10, x *)
answered Apr 25 at 0:55
m0nhawkm0nhawk
2,92711532
2,92711532
add a comment |
add a comment |
$begingroup$
Yes, there is a built-in function for what you want to do.
data = 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x;
Catenate @ data
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
$endgroup$
add a comment |
$begingroup$
Yes, there is a built-in function for what you want to do.
data = 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x;
Catenate @ data
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
$endgroup$
add a comment |
$begingroup$
Yes, there is a built-in function for what you want to do.
data = 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x;
Catenate @ data
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
$endgroup$
Yes, there is a built-in function for what you want to do.
data = 1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x;
Catenate @ data
1, x, 2, x, 3, x, 4, x, 5, x, 6, x, 7, x, 8, x, 9, x, 10, x
answered Apr 25 at 6:48
m_goldbergm_goldberg
89.4k873202
89.4k873202
add a comment |
add a comment |
3
$begingroup$
try
Flatten[list,1]
$endgroup$
– J42161217
Apr 25 at 0:55
1
$begingroup$
One can also consider using
Join @@ yourlist
.$endgroup$
– Αλέξανδρος Ζεγγ
Apr 25 at 3:27