|
[Date Index]
[Thread Index]
[Author Index]
Re: more elements in a list
- To: mathgroup at smc.vnet.net
- Subject: [mg32290] Re: more elements in a list
- From: "hf1" <hf1 at nyu.edu>
- Date: Fri, 11 Jan 2002 04:35:26 -0500 (EST)
- Organization: New York University
- References: <a1gv6a$n6n$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"merkat" <cabanc at hotmail.com> wrote in message
news:a1gv6a$n6n$1 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
In[20]:=
s = {a, b, c}; x = {2, 5, 4};
sam[{a_, b_}] := PadRight[ {a}, b, a]
Flatten[Map[sam, Thread[{s, x}]]]
Out[22]=
{a, a, b, b, b, b, b, c, c, c, c}
Howard Fink
Prev by Date:
Re: Logit Probit in Mathematica
Next by Date:
more elements in a list
Previous by thread:
RE: more elements in a list
Next by thread:
more elements in a list
|