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: [mg69952] Re: How to remove just the outermost braces of a list?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 28 Sep 2006 06:15:05 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <efarmd$7vg$1@smc.vnet.net> <efdjlq$md$1@smc.vnet.net>

ben wrote:
> Nasser Abbasi schrieb:
> 
>> hello
>>
>> I thought this will be easy, but I can't seem to find an easy way to do the
>> following.
>>
>> e={a,{b}}
>> Print[e]  ------> This will print {a,{b}}
>>
>> What can I do to make it print   a,{b}  ?
>>
>> Flatten does not do it.  TableForm came close, but it removes all braces,
>> not just the outermost.
>>
>> Many times I get a list as a result which I want to print, but I do not want
>> the outermost braces to be displayed as well. I want to display just the
>> content of the list.
>>
>> thanks,
>> Nasser
> 
 > Do[Print[e[[i]]], {i, Length[e]}] ?
 >

I am afraid the above expression does not fit the needs of the OP since 
the elements of the original list are displayed along a column rather 
than on a line:

e = {a, {b}, c, {{d}}}; Do[Print[e[[i]]], {i, Length[e]}]
-->
a
{b}
c
{{d}}

Regards,
Jean-Marc


  • Prev by Date: Re: C-formatted strings back to Expressions
  • Next by Date: mathematica link
  • Previous by thread: Re: How to remove just the outermost braces of a list?
  • Next by thread: conversion to InputForm without spaces