Inventory sequence: Difference between revisions
→{{header|RPL}}: improved code
(added RPL) |
(→{{header|RPL}}: improved code) |
||
Line 686:
=={{header|RPL}}==
For efficiency reasons, two different programs are needed to generate the sequence or search for the first high value.
« → max
'''WHILE'''
1 CF 0▼
0 max '''FOR''' j
'''IF''' DUP NOT '''THEN'''
» '<span style="color:blue">INVT</span>' STO <span style="color:grey">@ ''( n → { a(1)..a(n)} )''</span>▼
▲ » '<span style="color:blue">INVT</span>' STO <span style="color:grey">@ ''( n → { a(1)..a(n)} )''</span>
« DUP 1 + { } + 0 CON -1 → max counts j
Line 710 ⟶ 709:
'''END'''
'''UNTIL''' 2 FS? '''END'''
» » '<span style="color:blue">INVT1ST</span>' STO <span style="color:grey">@ ''( n → 1st_value_>_n pos )''</span>
100 <span style="color:blue">INVT</span>
|