Difference between revisions of "Loop.R"
From Organic Design wiki
m |
(0 -> 6) |
||
Line 9: | Line 9: | ||
# seq makes a sequence from 1 to 8+5-1 | # seq makes a sequence from 1 to 8+5-1 | ||
# %% yields the modulus remainder of a division | # %% yields the modulus remainder of a division | ||
− | loops <- | + | loops <- 0:(loop+comp-1) %% loop +1 |
for(i in seq(loop)){ | for(i in seq(loop)){ | ||
print(loops[seq(from=i, length=comp)]) | print(loops[seq(from=i, length=comp)]) | ||
} | } |
Revision as of 01:39, 12 December 2005
- ==============================================================================
- Loop evaluation e.g. 8 parts, 5 comparisons
- ==============================================================================
start <- 1
loop <- 6
comp <- 4
- seq makes a sequence from 1 to 8+5-1
- %% yields the modulus remainder of a division
loops <- 0:(loop+comp-1) %% loop +1
for(i in seq(loop)){
print(loops[seq(from=i, length=comp)])
}