Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Combining elements of a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108852] Re: Combining elements of a list
  • From: "Hans Michel" <hmichel at cox.net>
  • Date: Sun, 4 Apr 2010 07:44:34 -0400 (EDT)
  • References: <hp7735$krb$1@smc.vnet.net>

Jason Ebaugh:

You can try the following:

In[16]:= phrase = 
{{"t","h","i","s"},{"i","s"},{"a"},{"t","e","s","t"},{"m","e","s","s","a","g","e"}}
Out[16]= {{t,h,i,s},{i,s},{a},{t,e,s,t},{m,e,s,s,a,g,e}}

In[17]:= StringJoin[Flatten[Riffle[phrase," "],Infinity]]
Out[17]= this is a test message

However, I am concerned about how will you arrive at
{h,e,l,l,o}
 or even  {{t,h,i,s},{i,s},{a},{t,e,s,t},{m,e,s,s,a,g,e}}.
You are asking us to help solve this particular case/problem. But depending 
on how you arrived at this list in may be possible to avoid the trap 
alltogether.

Hans


<ebaugh at illinois.edu> wrote in message news:hp7735$krb$1 at smc.vnet.net...
>
> How could I go from:
> {h,e,l,l,o}
> to
> {hello}?
>
> That is the first step of what I am really looking to do. Which is
> to go from:
> {{t,h,i,s},{i,s},{a},{t,e,s,t},{m,e,s,s,a,g,e}}
> to
> "this is a test message"
>
> Thanks all,
> Jason Ebaugh
>
>
> 



  • Prev by Date: Orientation of Arrowheads
  • Next by Date: Re: Combining elements of a list
  • Previous by thread: Re: Combining elements of a list
  • Next by thread: Re: Combining elements of a list