I've been messing around with generating all possible combinations of a set of letters, (Ala, a 6 letter set would start enumerating at "aaaaaa" then move on to "aaaaab" so on and so forth, all the way down to "zzzzz") by iterating through an array using slice() , Which is a pretty good implementation for small tasks, But suppose I wanted to generate larger sets, Is there a more efficient implementation than say
I've been messing around with generating all possible combinations of a
set of letters, (Ala, a 6 letter set would start enumerating at "aaaaaa"
then move on to "aaaaab" so on and so forth, all the way down to
"zzzzz")
("aaaaaa".."zzzzzz").each do |string|
puts string
end
This will run for a good while, but it won't hog memory the way a solution
populating an array would.
HTH,
Sebastian
···
--
NP: Lake of Tears - Sweetwater
Jabber: sepp2k@jabber.org
ICQ: 205544826
I've been messing around with generating all possible combinations of a
set of letters, (Ala, a 6 letter set would start enumerating at "aaaaaa"
then move on to "aaaaab" so on and so forth, all the way down to
"zzzzz")
("aaaaaa".."zzzzzz").each do |string|
puts string
end
This will run for a good while, but it won't hog memory the way a solution populating an array would.
Or use the Combinatorial Object Server and the Hpricot gem. Pass in your parameters for the combinatorial object and scrape your results out of the table cells. I don't believe there is an API for the COS but scraping the hrml results is quite easy.