c3d / db48x

RPL runtime for the DM42 calculator, in the spirit of HP48/49/50
http://48calc.org
GNU Lesser General Public License v3.0
86 stars 11 forks source link

Add assignment operations #1262

Open c3d opened 3 hours ago

c3d commented 3 hours ago

In order to be able to document the built-in equations in a way that is usable in practice, we need to have a quick way to describe a number of variables.

A possible approach is to have an assignment object that is similar internally to unit objects, but with a = separator and a name on the left. This would work like the operator on the HP50G.

Proposed syntax:

A=50_m
B='30_cm+25_mm'

Note that the syntax cannot be accepted inside algebraic expressions, but it could be rendered as:

50_m▶A
'(30_cm+25_mm)▶B'

This behaves like STO but returns the input value on the stack.

Wiljea commented 2 hours ago

So contrary to STO it doesn't consume the value on level 1 of the stack, isn't it ?

c3d commented 1 hour ago

Separate assignment operation and assignment object.

The assignment object also tags the result.