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: [mg32276] Re: more elements in a list
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 9 Jan 2002 23:37:53 -0500 (EST)
  • References: <a1gv6a$n6n$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

merkat,

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

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

    MapThread[Sequence@@Table[#,{#2}]&,{{a,b,c},{2,5,4}}]

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

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"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
>




  • Prev by Date: Re: Closing a dialogue box with Mathematica
  • 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