Re: my brain block
- Posted by Kat <gertie at PELL.NET> Aug 09, 2000
- 489 views
That's what i did in my olde pascal days (daze?), but it also had the problem of not knowing how many (in pascal) substrings there were. I suppose i could just scale it up to some enormous nest of such, like you have for 3, but make an include with 500 of them, i used 50 in the pascal code, but surely there is a faster and smaller way to do this. Any idea on how much Eu can recurse? Kat On 9 Aug 2000, at 12:22, simulat wrote: > Hi Kat > This isn't recursive, but it would work with whatever goes into seqA, seqB > and seqC. > > for a = 1 to length(seqA) do > for b = 1 to length(seqB) do > for = 1 to length(seqC) do > resultholder &= seqA[a] & seqB[b] & seqC[c] > end for > end for > end for > > What's the structure for the seqA, seqB, etc? > if it was something like SEQ=seqA & seqB & seqC & . . . > Then you could modify the above to: > > for q = 1 to length(SEQ) do > for a = 1 to length(SEQ[1]) do > for b= 1 to length(SEQ[2]) do > for c= 1 to length(SEQ[3]) do > resultholder &= SEQ[1][a] & SEQ[2][b] & SEQ[3][c] > end for > end for > end for > end for > > I can never get my head wrapped around recursion. The idea is simple - a > function that calls itself until an escape condition is met - but I have a > hard job applying it to actual cases. > > Bye > Martin > > simulat at intergate.bc.ca > http://www.intergate.bc.ca/personal/simulat/Index.html > > > ----- Original Message ----- > From: Kat <gertie at PELL.NET> > To: <EUPHORIA at LISTSERV.MUOHIO.EDU> > Sent: Wednesday, August 09, 2000 11:56 AM > Subject: my brain block > > > > Hey all, i can't seem to get by this one, and it's an old problem with the > new Eu > > sequence twist..... > > > > Given: > > seqA = {"one","","three","","","six"} > > seqB = {"1","2","","","5",""} > > seqC = {"uno","dos","tres","","cinco",""} > > > > How do i make a list of all the possible combinations, using recursion? It > hasto use > > recursion, because i don't know the length of seqA or seqB or seqC. All > the seqX > > should be the same length, but with different contents,, and i don't know > how many > > seqX there are,, could be 1 or could be 10 or could be 50. Matching > against a blank > > subseq is not needed or good. > > > > Results for 3 seqX needed: > > "one","1","uno" > > "one","1","dos" > > "one","1","tres" > > "one","1","cinco" > > "three","1","uno" > > "three","1","dos" > > "three","1","tres" > > "three","1","cinco" > > > > etc,, all possible pairings, regardless of if they are the correct > translation. > > > > Kat, > > befuddled, > > and wondering now who Fud was.... > > > >