[18787] in s-news-athena

home help back first fref pref prev next nref lref last post

[S] Help eliminate a recursive function

daemon@ATHENA.MIT.EDU (David E. Moore)
Thu Jul 29 16:40:45 1999

From: "David E. Moore" <moordi@email.uc.edu>
To: <s-news@wubios.wustl.edu>
Date: Tue, 27 Jul 1999 16:58:21 -0400
Message-Id: <003901bed872$c2d84fa0$315c8981@ucids02.mcm.uc.edu> 
Mime-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Dear S-Plus programmers,
I have a simple problem for a recursive function that understandably 
blows up in S+.  I would really appreciate it, therefore, if someone 
could show me how to code around the recursion.  Here's the problem:
I want to generate every possible combination of n elements from a 
given vector.  For example, every possible combination of 5 numbers 
taken from the sequence 1:10.  I then need to process each and every 
combination before proceeding to the next one.  Thus, while I need to 
perform some operations on each combination, I don't need (nor want) 
to store them all.
The reason I need an alternative approach is that I'm working with 
very large numbers.  The number of combinations quickly becomes 
unmanageable using every approach that I've tried, so I'm hoping 
someone who knows S+ can show me how this can be done in an 
efficient manner.  I will happily provide whatever details seem 
necessary to identify the particular S+ practices that might be 
relevant to my problem.  Thanks for any suggestions.
David Moore
Sender: owner-s-news@wubios.wustl.edu
Precedence: bulk
X-loop: s-news


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

home help back first fref pref prev next nref lref last post