Loops/Wrong ranges: Difference between revisions
m
→{{header|Perl 6}}: at this point I'm just screwin' around.
(Added C) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: at this point I'm just screwin' around.) |
||
Line 268:
Also note: The iterator function for the sequence is literally a function. It is any expression that produces a value. These sequences all use simple arithmatic increments but that is not a limitation of the sequence operator.
<lang perl6># Given sequence definitions
Line 304 ⟶ 303:
say [0,1,2,3,4,5], *.rotate(-1) … !*.tail;
# Iterate
put '
{{out}}
<pre>Start: -2, Stop: 2, Increment: 1 | -2 -1 1 2
Line 321 ⟶ 320:
1 -0.5 1.4142135623730951 -0.7071067811865476 0.5000000000000001 -0.5000000000000002 0.176776695296637 -0.04419417382415928 0.0039062500000000095
([0 1 2 3 4 5] [5 0 1 2 3 4] [4 5 0 1 2 3] [3 4 5 0 1 2] [2 3 4 5 0 1] [1 2 3 4 5 0])
=={{header|Python}}==
|