MathGroup Archive 2002

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

Search the Archive

RE: more elements in a list


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