       RE: more elements in a list

• To: mathgroup at smc.vnet.net
• Subject: [mg32390] RE: [mg32241] more elements in a list
• From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.de>
• Date: Fri, 18 Jan 2002 00:17:36 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Merkat,

There have been quite a few answers on this problem. Here is another one:

In:=

Out=
{a,a,b,b,b,b,b,c,c,c,c}

You have to specify repetions then, instead of number of occurrences. If you
don't like this, add the precomputation for that:

In:=
Unevaluated[
{xx->Join@@{a,b,c}, yy->Join@@({2,5,4}-1)}

Out=
{a,a,b,b,b,b,b,c,c,c,c}

But, alas, this solution will not allow for zero occurrances  ;-)
--
Hartmut

> -----Original Message-----
> From:	merkat [SMTP:cabanc at hotmail.com]
To: mathgroup at smc.vnet.net
> Sent:	Wednesday, January 09, 2002 9:18 AM
> To:	mathgroup at smc.vnet.net
> Subject:	[mg32241] more elements in a list
>
> 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: Exploring Analytic Geometry by Vossler
• Next by Date: Re: Taylor Series Expansions
• Previous by thread: more elements in a list
• Next by thread: Logit Probit in Mathematica