Skip to content

Needs Stack Rotation commands #9

@bobpaul

Description

@bobpaul

Basic RPN calculators usually have Swap, Rotate Up, Rotate Down, and "Repeat last value". This implementation is missing the rotate functions. The rotate functions, when combined with swap are sufficient to completely re-order the stack into any position you'd like.

Rotate Up

  • Remove the item the top of the stack
  • Insert it to the bottom of the stack

Ex: If the stack is

832
114
23
15

[R↑] will set the stack to

114
23
15
832

Rotate Down

  • Remove the item from the bottom of the stack
  • Insert it onto the top of the stack

Ex: If the stack is

832
114
23
15

[R↓] will set the stack to

15
832
114
23

Because of how these operations are frequently combined, I would like to see the secondary screen organized as

[  ⇩  ][  R↑ ]       [ 1/x ]
[ DROP][  R↓ ]       [  xⁿ ]
       [  ↑↓ ]
       [Enter][SetDP]

But if it's important for muscle memory to keep the existing buttons where they are, I think this would also work well:

[  ⇩  ]              [ 1/x ]
[ DROP]              [  xⁿ ]
[  ↑↓ ][  R↑ ]
[Enter][  R↓ ][SetDP]

Example Usage. Sort the stack by numerically:

4
5
8
3
0

[ R↑ ][ ↑↓ ][ R↓ ][ ↑↓ ][ R↓ ][ R↓ ][ ↑↓ ][ R↓ ][ R↓ ] results in

8
5
4
3
0

When combined with [Enter] to duplicate the number on the bottom of the stack we end up with a powerful calculator that effectively have unlimited accumulators. While basic calculators often have MR, MC, M+ and M- to provide a single off-screen accumulator, the rotate functions make it easy to work on multiple, unrelated computations simultaneously without clearing the screen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions