newRPL: Alpha demo 0.9 released [UPDATED 2017-10-25]
|
08-29-2017, 03:18 PM
Post: #72
|
|||
|
|||
RE: newRPL: Alpha demo 0.9 released [UPDATED 2017-08-24]
(08-29-2017 04:25 AM)The Shadow Wrote: Something weird is going on with EVAL. And after a lot of experimentation after getting very strange answers, I think I've figured out what. It's not weird at all once you understand some basic concepts of expressions in newRPL:
Canonical form enforces a few internal rules that make manipulating an expression a lot simpler:
And a few other rules that I can't recall. So when you type: '2+3+1' you generate an object with a tree structure (+ (+ 2 3) 1) because for the parser + is a binary operator, but for the (future) CAS to operate properly, it flattens the tree to (+ 2 3 1), which makes it simpler to simplify terms, search for expressions, cancel out terms, etc. Your fraction '2/3' is converted after EVAL to '2*INV(3)' per the rules above. What you get from OBJ-> is one level expansion of the main operator. Perhaps OBJ-> should convert to canonical form always before expanding, so you get consistent results every time. Other than that, everything works as designed. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)