Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69901] Re: How to remove just the outermost braces of a list?
  • From: dimmechan at yahoo.com
  • Date: Wed, 27 Sep 2006 06:04:11 -0400 (EDT)
  • References: <efarmd$7vg$1@smc.vnet.net>

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?