RE: all possible letter combinations

2008-02-14 Thread Bobby Hartsfield
Actually, permutation is your friend... and there are tons of code samples and algorithms out there. I'd start here. http://www.google.com/search?hl=en&client=firefox-a&channel=s&rls=org.mozill a%3Aen-US%3Aofficial&hs=mXk&q=permutation+coldfusion&btnG=Search ..:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfie

Re: all possible letter combinations

2008-02-14 Thread Greg Morphis
Hey that's pretty smooth. I appreciate it!! On Thu, Feb 14, 2008 at 1:27 PM, Jeff Price <[EMAIL PROTECTED]> wrote: > Try this chunk of code. I leave it up to you to add in a remove duplicates > feature. Check cflib.org for some handy functions to do that. > > NOTE: I found it easier to build a l

Re: all possible letter combinations

2008-02-14 Thread Jeff Price
Try this chunk of code. I leave it up to you to add in a remove duplicates feature. Check cflib.org for some handy functions to do that. NOTE: I found it easier to build a list instead of an array simply because I could recurse with ListAppend but if I recurse with ArrayAppend it starts making

Re: all possible letter combinations

2008-02-14 Thread Ben Doom
I'd make some changes to make it easier to read. First, instead of wordarray[arraylen(wordarray)+1] = ... I'd use arrayappend(). Second, if you aren't going to use ccArr, sbArr, and rcArr, remove them from the function. They are just confusing. If the length of remainingchars is 1, you don't

Re: all possible letter combinations

2008-02-14 Thread Greg Morphis
I thought I had it with this.. which is similiar to what you suggested Ben if(len(remainingchars) eq 1) { wordArray[ArrayLen(wordArray)+1] = strbase & mid(remainingchars,1,1);

Re: all possible letter combinations

2008-02-14 Thread Ben Doom
In pseudocode: function f(sofar, more) { array strings foreach letter in more { strings = f(foreach+letter, more-letter) } return strings } HTH. --Ben Doom Greg Morphis wrote: > anyone else? I was hoping to do this in CF alone? > > Thanks

Re: all possible letter combinations

2008-02-14 Thread Greg Morphis
anyone else? I was hoping to do this in CF alone? Thanks On Wed, Feb 13, 2008 at 6:59 PM, Dawson, Michael <[EMAIL PROTECTED]> wrote: > Thinking outside the box... You could use a database for this. Create a > table that contains a single column. That column contains a record for each > lette

RE: all possible letter combinations

2008-02-13 Thread Dawson, Michael
Thinking outside the box... You could use a database for this. Create a table that contains a single column. That column contains a record for each letter of the alphabet. Then, do a cartesian join to join that table to itself, three other times. Concatenate the fields and you should have e

Re: all possible letter combinations

2008-02-13 Thread Greg Morphis
This is what I have so far.. if(len(remainingchars) eq 1) { wordArray[ArrayLen(wordArray)+1] = strbase & mid(remainingchars,1,1); } else { for (j = 1; j lt len(remainingchars); j=j+1) {

Re: all possible letter combinations

2008-02-13 Thread Mark Mandel
What have you got so far? Mark On Feb 14, 2008 10:58 AM, Greg Morphis <[EMAIL PROTECTED]> wrote: > yes, I know that and it's that part that I need help with which is why > I posted here. > Thanks > > On Feb 13, 2008 5:34 PM, Mark Mandel <[EMAIL PROTECTED]> wrote: > > Recursion is your friend ;o)

Re: all possible letter combinations

2008-02-13 Thread Greg Morphis
yes, I know that and it's that part that I need help with which is why I posted here. Thanks On Feb 13, 2008 5:34 PM, Mark Mandel <[EMAIL PROTECTED]> wrote: > Recursion is your friend ;o) > > Mark > > > On Feb 14, 2008 9:57 AM, Greg Morphis <[EMAIL PROTECTED]> wrote: > > Given a string, e.g. "ABCD

Re: all possible letter combinations

2008-02-13 Thread Mark Mandel
Recursion is your friend ;o) Mark On Feb 14, 2008 9:57 AM, Greg Morphis <[EMAIL PROTECTED]> wrote: > Given a string, e.g. "ABCD" > > I need to come up with all combinations of letters > eg > ABCD > ABDC > ACBD > ACDB > > > And exlude strings like '', 'AAAB' unless you pass a string with