|
-
April 1st, 2011, 11:58 AM
#12
Re: Iteration and recursion
 Originally Posted by erotavlas
I think that it realizes the behaviour of nested loops.
Code:
Example:
For x For y For z -> variablesVector[x,y,z]
Domain for each variable -> Data
for x in subset(Data)
for y in subset(Data)
for z in subset (Data)
do (x,y,z)
Not exactly, since what you've shown uses the same domain for each variable. IOW, 'Data' is the domain for all variables, not for each variable.
 Originally Posted by erotavlas
Do you have a suggestions about how can I do to reduce the complexity of huge number of recursive calls?
What do you mean with "complex"? The design suggested by JohnW is probably the least complex, since all the iteration logic is encapsulated and separate from the logic in the inner loop's body.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|