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: [mg32273] RE: [mg32241] more elements in a list
  • From: "David Park" <djmp at earthlink.net>
  • Date: Wed, 9 Jan 2002 23:37:40 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Merkat,

Here is one method:

list1 = {{a, b, c}, {2, 5, 4}} // Transpose
{{a, 2}, {b, 5}, {c, 4}}

list1 /. {sym_, n_Integer} :> Array[sym & , n]// Flatten
{a, a, b, b, b, b, b, c, c, c, c}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 

> From: merkat [mailto:cabanc at hotmail.com]
To: mathgroup at smc.vnet.net
> 
> 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: arguments/realtime3d
  • 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