Re: Re: more elements in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg32287] Re: [mg32263] Re: [mg32241] more elements in a list
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Fri, 11 Jan 2002 04:35:22 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Since my first answer was a bit too much like everyone else's, here is one that is a little more original :) In[2]:= l1={a,b,c}; l2={2,5,4}; In[6]:= Flatten[l1^l2/.Power[x_,n_]:>Table[x,{n}]] Out[6]= {a,a,b,b,b,b,b,c,c,c,c} On Thursday, January 10, 2002, at 01:37 PM, Andrzej Kozlowski wrote: > Lots of different ways, I am sure. Here is just the first one I came up > with: > > In[2]:= > l1={a,b,c}; > > In[3]:= > l2={2,5,4}; > > In[4]:= > Flatten[Inner[Table[#,{#2}]&,l1,l2,List]] > > Out[4]= > {a,a,b,b,b,b,b,c,c,c,c} > Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ > > On Wednesday, January 9, 2002, at 05:17 PM, merkat wrote: > >> Hi , >> >> How do I multiply the number of elements in a list? >> I have the lists: >> {a,b,c} and >> {2,5,4} >> >> the result should be: >> {a,a,b,b,b,b,b,c,c,c,c} >> >> Merkat >> >> >> >> > > >