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













2












$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?










share|improve this question











$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
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 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















2












$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?










share|improve this question











$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
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 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













2












2








2





$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?










share|improve this question











$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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
If this question can be reworded to fit the rules in the help center, please edit the question.







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
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 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












  • 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







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










2 Answers
2






active

oldest

votes


















7












$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 *)





share|improve this answer









$endgroup$




















    1












    $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






    share|improve this answer









    $endgroup$



















      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      7












      $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 *)





      share|improve this answer









      $endgroup$

















        7












        $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 *)





        share|improve this answer









        $endgroup$















          7












          7








          7





          $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 *)





          share|improve this answer









          $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 *)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 25 at 0:55









          m0nhawkm0nhawk

          2,92711532




          2,92711532





















              1












              $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






              share|improve this answer









              $endgroup$

















                1












                $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






                share|improve this answer









                $endgroup$















                  1












                  1








                  1





                  $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






                  share|improve this answer









                  $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







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 25 at 6:48









                  m_goldbergm_goldberg

                  89.4k873202




                  89.4k873202













                      Popular posts from this blog

                      Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                      Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                      What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company