s-news
[Top] [All Lists]

[S] Help eliminate a recursive function

To: <s-news@wubios.wustl.edu>
Subject: [S] Help eliminate a recursive function
From: "David E. Moore" <moordi@email.uc.edu>
Date: Tue, 27 Jul 1999 16:58:21 -0400
Importance: Normal
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

<Prev in Thread] Current Thread [Next in Thread>