MathGroup Archive 2002

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

Search the Archive

Re: more elements in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32263] Re: [mg32241] more elements in a list
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Wed, 9 Jan 2002 23:37:19 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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
>
>
>
>



  • Prev by Date: RE: more elements in a list
  • Next by Date: Re: more elements in a list
  • Previous by thread: RE: more elements in a list
  • Next by thread: Re: more elements in a list