MathGroup Archive 2001

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

Search the Archive

Re: DO if Loop

  • To: mathgroup at
  • Subject: [mg26648] Re: DO if Loop
  • From: Ulrich Hofstoetter <ulrich.hofstoetter at>
  • Date: Sat, 13 Jan 2001 22:36:22 -0500 (EST)
  • Organization: Visual Analysis
  • References: <93kk9f$>
  • Sender: owner-wri-mathgroup at

Bob Hallam wrote:

> Hello,
> I have a matrix function and a list of 2622 variables in groups of 3.  I
> need to apply this function to each set of 3 variables continuing until
> finished with the list.
> How is this done?
> Best Regards,
> Bob

Partition[list,3] gives you a list of subsets with 3 elements, Map can apply

a function to each of these subsets and Flatten can recombine them.
But you still would have to handle the last elements of the list, as
discards all extra elements that cannot be put into subsets of 3 elements


Dipl.-Inf. Ulrich Hofstoetter
Visual Analysis GmbH
Neumarkter Str. 87
D - 81673 Munchen

Tel: (+49)89-431981-38
Fax: (+49)89-431981-1
e-mail: ulrich.hofstoetter at

  • Prev by Date: Re: Re: Random Sampling Without Replacement?
  • Next by Date: Re: How can I transform the number of 123.456 into "123.456"?
  • Previous by thread: Re: DO if Loop
  • Next by thread: RE: DO if Loop