Message Boards Message Boards

[✓] Remove the brackets around a list?

GROUPS:

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

POSTED BY: Javad Emami
Answer
13 days ago

Hi.

Try:

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

Regards Mariusz

POSTED BY: Mariusz Iwaniuk
Answer
13 days ago

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

POSTED BY: Henrik Schachner
Answer
12 days ago

Group Abstract Group Abstract