newRPL  build 1255 released! [updated to 1299]

12192018, 11:49 PM
Post: #342




RE: newRPL  build 1089 released! [update:build 1127]
(12192018 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 doublestruck, 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 32bit 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 09 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. 

« Next Oldest  Next Newest »

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