MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to remove just the outermost braces of a list?


Hello Nasser.

What you want is very easily.
Here is one way.

e = {a, {b}}
{a, {b}}

Print[e[[1]], ToString[","], e[[2]]]
a\[InvisibleSpace],\[InvisibleSpace]{b}

For example considering the following list of data.

lst=Table[{Random[Integer,{0,10}],{Random[Real,{0,1}]}},{10}]
{{10,{0.0168788}},{8,{0.157912}},{1,{0.114837}},{0,{0.296168}},{0,{0.487691}},
{3,{0.197697}},{8,{0.592393}},{10,{0.803263}},{9,{0.414755}},{8,{0.400607}}}

Then

Map[Print[First[#],ToString[","],Last[#]]&,lst];
10\[InvisibleSpace],\[InvisibleSpace]{0.0168788}
8\[InvisibleSpace],\[InvisibleSpace]{0.157912}
1\[InvisibleSpace],\[InvisibleSpace]{0.114837}
0\[InvisibleSpace],\[InvisibleSpace]{0.296168}
0\[InvisibleSpace],\[InvisibleSpace]{0.487691}
3\[InvisibleSpace],\[InvisibleSpace]{0.197697}
8\[InvisibleSpace],\[InvisibleSpace]{0.592393}
10\[InvisibleSpace],\[InvisibleSpace]{0.803263}
9\[InvisibleSpace],\[InvisibleSpace]{0.414755}
8\[InvisibleSpace],\[InvisibleSpace]{0.400607}

Regards
Dimitris


  • Prev by Date: Mac, Mathematica, and AuthorTools: Another suffix gotcha
  • Next by Date: How Mathematica saved me about $40 in 5 minutes. Using it to create animated gif file.
  • Previous by thread: Re: How to remove just the outermost braces of a list?
  • Next by thread: Re: How to remove just the outermost braces of a list?