Message Boards Message Boards

GROUPS:

[✓] Remove the brackets around a list?

Posted 11 months ago
1160 Views
|
2 Replies
|
2 Total Likes
|

Is there a function in mathematica to remove the brackets around a list: Say {1,2,3} becomes 1,2,3. I tried Flatten it didn't work Thank You JME

2 Replies

Hi.

Try:

Row[{1, 2, 3}, ","]

Regards Mariusz

Javad,

what a Mathematica expression returns is always another - single! - Mathematica expression. Just three numbers 1 2 3 represent three(!) expressions. If you want to have the {} removed just in the context of visibility or presentation then the above solution of Mariusz is perfect. You have to be aware that it is still a single expression:

Row[{1, 2, 3}, ","] // FullForm
(* Out:   Row[List[1,2,3],","] *)

If your question is meant in a more syntactical context you probably need Sequence:

s = Sequence @@ {1, 2, 3};
{a, s, b}
(* Out: {a,1,2,3,b} *)

Regards -- Henrik

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract