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: [mg32250] Re: [mg32241] more elements in a list
  • From: Adriano Pascoletti <pascolet at dimi.uniud.it>
  • Date: Wed, 9 Jan 2002 23:37:02 -0500 (EST)
  • References: <200201090817.DAA23662@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

At 3:17 -0500 9-01-2002, 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

Join @@ MapThread[PadRight[{#1}, #2, #1] &, {{a, b, c}, {2, 5, 4}}]

yields

{a, a, b, b, b, b, b, c, c, c, c}

Adriano Pascoletti


  • 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