Post Reply 
newRPL - build 1255 released! [updated to 1299]
12-19-2018, 11:49 PM
Post: #342
RE: newRPL - build 1089 released! [update:build 1127]
(12-19-2018 10:22 PM)Claudio L. Wrote:  I think we need a way to display the attributes of variables, though. I'd like a variable to be called the same, but look different based on its attributes. For example, bold text might be constant variables, perhaps complex ones could be double-struck, and matrices and vectors could have a line over them (like complex infinity does). We'd need a lot of work on fonts though.

Thinking out loud...
What we have implemented is a 32-bit word of 'attributes' that goes optionally attached to every IDENT object. So we can easily add CAS information about every variable.
Question is how does the user add/edit/delete those attributes?
Of course, in the distant future the equation editor will allow the user to check a few boxes to change the attributes of a variable.
But in reality it should also be:
* persistent across edits in the command line
* persistent when sharing the expression as decompiled source code
* visible on the screen

What if we use the subscript numbers? We have readily available in the keyboard the numbers from 0-9 so it would be easy to type/edit (not easy to remember what the attributes mean, though).
The compiler would recognize these subscripts, remove them from the name and store them in the attribute word. In the same way, the decompiler can extract the bits, convert to decimal and add the text after the variable name.
A code enhancer/pretty print could detect these numbers in the same way and replace them with bold font, etc depending on variable type.
A flag could control if the numbers are actually displayed or not on the stack.

One possible encoding (using 2 digits) could be:
0 = (no subscript) = unknown type, assumed complex by default
1 = real variable
2 = constant (real or complex)
3 = matrix
Second digit (optional additional knowledge about the variable, these are bits):
When first digit is 0,1,2:
1 = value cannot be negative (>=0)
2 = value cannot be positive (<=0)
4 = value cannot be zero
5,6,7 = combinations of previous bits
When first digit is 3 (matrix):
1 = matrix is square
2 = matrix is symmetric (A = AT)
3 = matrix is invertible (INV(A) exists)
4 = matrix is orthogonal (AT = INV(A))

So for example, 'A₃₃*X₃' means A is a matrix (first 3) and is invertible (second 3), while X is a matrix but no other information is known.
For display, a flag could hide the numbers and show just 'A*X', only showing the numbers when editing.
Perhaps a menu could help tick boxes to change the subscripts while in the editor.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
newRPL - brickviking - 10-05-2018, 06:01 AM
RE: newRPL - build 1089 released! [update:build 1127] - Claudio L. - 12-19-2018 11:49 PM
How to participate? - erazor - 12-13-2019, 07:12 AM



User(s) browsing this thread: 1 Guest(s)