Any idea that has received less than 6 kudos within 6 years after posting will be automatically declined.
Wiring an array (1 D) to a For Loop's Count (N) Terminal would automatically set the number of iterations to the array size. This would avoid having to insert an Array Size primitive to accomplish that.
I think it's easier to understand if you see the code what is being done with the proposed solution rather than array reshaping..... Possibly more efficient also.
2) The smallest of any autoindexing arrays used as input.
Allowing to connect to the N terminal allows the user to unambiguously set the number of iterations regardless of the contents of other arrays which may also be set to autoindex.
Not completely true. The For Loop iterates for the smallest number of either 1 or 2. If you wire a larger number to N like 100 thinking the loop will unambiguously run 100 times, that is not true if an autoindexing array only has 5 elements.
Message Edited by Ravens Fan on 08-12-2009 12:24 PM
Even with this shortcut for setting N to the size of an array, the loop should still execute min(N, min(size of all arrays wired to auto-indexing tunnels)) iterations. It would be confusing if N had the old behavior when a scalar was wired to it and forced the actual number of iterations when an array was wired to it.
Once upon a time Altenbach suggested that each tunnel could have "active" or "passive" indexing (or whatever other term you wish to use) - the active tunnels would determine the number of iterations and the passive ones would not. If the passive array does not have enough elements, the default value would be used. What do people think of that implementation?
I'd have to think of a use case for that one, but that does makes sense.
But another idea that may have some use. Suppose the auto-indexed tunnel would automatically wrap around to the 0th index once it reached the end of the array?
Any idea that has received less than 6 kudos within 6 years after posting will be automatically declined.