|
|
Am 11.09.2017 um 19:46 schrieb Bald Eagle:
>
>> I might try to code it up tonight, unless someone beats me to it ;)
>
> or over lunch :D
>
> Like so:
>
> #macro CycleValues (_Array, _Counter)
> // Round-robin cycle through N values
> // Bill Walker September 2017
> #local N = dimension_size (_Array, 1);
> #local selector = mod (_Counter, N);
> // selector will range from 0 to N-1
> // Return the value in _Array corresponding to _Counter
> _Array [selector]
> #end // end macro CycleValues
>
>
> #declare RoundRobin = array [4] {2, 5, 9, 13};
> #for (i, 0, 10)
> #declare Value = CycleValues (RoundRobin, i);
> #debug concat ("Array value for i=", str(i, 2, 0), " is ", str(Value, 3, 0),
> "\n")
> #end // end for i
Invoking a macro in a loop? Can't imagine this to be of any use in terms
of efficiency ;)
Post a reply to this message
|
|