MathGroup Archive 2006

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

Search the Archive

RE: Partition

  • To: mathgroup at
  • Subject: [mg71670] RE: [mg71611] Partition
  • From: "David Park" <djmp at>
  • Date: Sun, 26 Nov 2006 03:48:55 -0500 (EST)


list = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o};

Partition the list into groups of 5. Then change each group to a Sequence of
the first element and the rest of the elements. You may want to look up
Sequence in Help.

list2 = Partition[list, 5]
{{a, b, c, d, e}, {f, g, h, i, j}, {k, l, m, n, o}}

Sequence @@ {First[#], Rest[#]} & /@ list2
{a, {b, c, d, e}, f, {g, h, i, j}, k, {l, m, n, o}}

David Park
djmp at

From: KFUPM [mailto:hussain.alqahtani at]

Dear All

I have a very large list of numbers that look like this: ( although the
size is different)


And i need to rewrite the list into


Since my list is too big, i need Mathematica to do it for me regardless
of the site of the list.

I would appreciate it if you can help me in this regard,



  • Prev by Date: Re: Plotting a function -
  • Next by Date: Re: Partition
  • Previous by thread: Re: Partition
  • Next by thread: Re: Partition