Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: "expanding a list"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57890] Re: "expanding a list"
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 11 Jun 2005 03:35:55 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 6/10/05 at 2:29 AM, mark at markscoleman.com (Mark Coleman) wrote:

>Greetings,
>
>I'd like to construct a list as follows. Say I have a list of reals
>{x1,x2,x3,...xn}, and another list of integers {r,s}. I'd like to
>make a new list

>{{x1,x1,x1,...},{x2,x2,x2....},{x3,x3,x3,...},....,{xn,xn,xn,...}},
>where the first sublist is of length r, and the remaining sublists
>are of length s.

Assume lst is set to your list of reals, then

Join[{Table[First@lst,{r}]},Rest@Transpose@Table[lst, {s}]]

should give you what you want.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: moving dingbats
  • Next by Date: Re: "expanding a list"
  • Previous by thread: Re: "expanding a list"
  • Next by thread: Re: "expanding a list"