Loops/Wrong ranges: Difference between revisions

m
→‎{{header|Perl 6}}: Add inexplicably missing sequence definition, add blurb for "other sequence" demo
m (→‎{{header|Perl 6}}: Add inexplicably missing sequence definition, add blurb for "other sequence" demo)
Line 484:
2, -2, 1, # Start more than stop: positive increment
2, 2, 1, # Start equal stop: positive increment
2, 2, -1, # Start equal stop: negative increment
2, 2, 0, # Start equal stop: zero increment
0, 0, 0, # Start equal stop equal zero: zero increment
Line 502 ⟶ 503:
# or either can be a function, list, or other object. Really anything that a
# "successor" function can be defined for and produces a value.
say "\nDemonstration of some other specialized sequence operator functionality:";
 
# Start with a list, iterate by multiplying the previous 3 terms together
# and end with a term defined by a function.
Line 519 ⟶ 520:
Start: 2, Stop: -2, Increment: 1 | 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Start: 2, Stop: 2, Increment: 1 | 2
Start: 2, Stop: 2, Increment: -1 | 2
Start: 2, Stop: 2, Increment: 0 | 2
Start: 0, Stop: 0, Increment: 0 | 0
Line 524 ⟶ 526:
Start: 0, Stop: 3.141592653589793, Increment: 0.7853981633974483 | 0 0.7853981633974483 1.5707963267948966 2.356194490192345 3.141592653589793
Start: 1.4, Stop: *, Increment: -7.1 | 1.4 -5.7 -12.8 -19.9 -27 -34.1 -41.2 -48.3 -55.4 -62.5 -69.6 -76.7 -83.8 -90.9 -98
 
Demonstration of some other specialized sequence operator functionality:
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])
10,333

edits