Skip to main content
added 132 characters in body
Source Link
rhermans
  • 37.4k
  • 4
  • 61
  • 152

I think ultimatelyUltimately, the answer by @Mr.Wizard is the way to create and manipulate many lists. ButBut, that doesn't answer theOP's question if youone can't create the lists yourselfoneself and need to deal with listlists already created with variouscomplicated names.

So, this answer your question, but ultimately the advisable implementation is the one by @Mr.Wizard

Using Names gives a list of the names of symbols that match the string or pattern,

Names["list*"]
(* {"list1", "list2", "list3", "list4"} *)

Therefore adding ToExpression and Catenate

Catenate[ToExpression /@ Names["list*"]] 

(* {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p} *)

So, this answer your question, but ultimately the advisable implementation is the one by @Mr.Wizard.

I think ultimately the answer by @Mr.Wizard is the way to create and manipulate many lists. But, that doesn't answer the question if you can't create the lists yourself and need to deal with list already created with various names.

So, this answer your question, but ultimately the advisable implementation is the one by @Mr.Wizard

Using Names gives

Names["list*"]
(* {"list1", "list2", "list3", "list4"} *)

Therefore adding ToExpression and Catenate

Catenate[ToExpression /@ Names["list*"]]

Ultimately, the answer by @Mr.Wizard is the way to create and manipulate many lists. But, that doesn't answer OP's question if one can't create the lists oneself and need to deal with lists already created with complicated names.

Using Names gives a list of the names of symbols that match the string or pattern,

Names["list*"]
(* {"list1", "list2", "list3", "list4"} *)

Therefore adding ToExpression and Catenate

Catenate[ToExpression /@ Names["list*"]] 

(* {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p} *)

So, this answer your question, but ultimately the advisable implementation is the one by @Mr.Wizard.

Source Link
rhermans
  • 37.4k
  • 4
  • 61
  • 152

I think ultimately the answer by @Mr.Wizard is the way to create and manipulate many lists. But, that doesn't answer the question if you can't create the lists yourself and need to deal with list already created with various names.

So, this answer your question, but ultimately the advisable implementation is the one by @Mr.Wizard

Using Names gives

Names["list*"]
(* {"list1", "list2", "list3", "list4"} *)

Therefore adding ToExpression and Catenate

Catenate[ToExpression /@ Names["list*"]]