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: [mg32300] Re: more elements in a list
  • From: "Dana" <ng_only at hotmail.com>
  • Date: Sat, 12 Jan 2002 05:18:10 -0500 (EST)
  • References: <a1gv6a$n6n$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I am very new at this.  I could not get Juan's excellent idea to work in
Mathematica 4.
However, I got it to work with a slight change:

(* z=Letters, n=numbers *)

In[2]:=
z={a,b,c};n={2,5,4} ;

In[6]:=
MapThread[Table, {z, List /@ n}] // Flatten

Out[6]=
{a,a,b,b,b,b,b,c,c,c,c}

= = = = = = =

I liked Andrzej idea also.  I noticed that if you change "List" to "Join"
then perhaps you can remove the "Flatten" command.

In[9]:=
Inner[Table[#1, {#2}] &, z,n,Join ]

Out[9]=
{a,a,b,b,b,b,b,c,c,c,c}

- - - - -
Dana DeLouis

--

"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: Factor, Expand. Daytime Hours.
  • Next by Date: Return
  • Previous by thread: Re: Re: more elements in a list
  • Next by thread: more elements in a list