newRPL - build 1255 released! [updated to 1299]
04-14-2018, 03:21 AM
Post: #197
 Claudio L. Senior Member Posts: 1,885 Joined: Dec 2013
RE: newRPL - build 1001 released! [update:build 1052]
(04-12-2018 11:28 PM)The Shadow Wrote:  I *really* like the identifier attributes, they seem quite elegant. How do you set them? Will all 32 be reserved for the system?

Also, what's the syntax of RULEMATCH and RULEAPPLY? Will rules be able to set attributes of results? If so, I think I see how to deal with, say, octonion math with relatively simple programming.

For now you don't set the attributes, the system will set them as needed (in the future, REALASSUME, and similar commands will change these attributes). Since there's no CAS yet, I don't know how many will be needed, if there's any extra, of course the user would be able to set them/clear them at will. For now I don't know, I'm slowly building the framework for the CAS, not the CAS itself yet.
There should be a thread on rules somewhere. But I never completed the algorithm, so it only does primitive replacements. Rules are symbolic expressions with a left part and right part, separated with the :-> operator (colon and right arrow).
They are meant to work as a search/replace pair
'X:->Z+1' will search for X and replace it with Z+1 when you APPLY the rule. That's done so far. The left expression can be more complex, and will do a match on the structure of the expression.
What's not done is the advanced stuff: using variables that start with a dot on the left expression would match a generic pattern and assign it to them, then the subexpression is replaced when you use the same dot variable on the right side.
For example:
'(.X+1)^2 :-> 2*(.X+1)*DERIV(.X)'

would find (Z/2+1)^2 and would replace it with 2*(Z/2+1)*DERIV(Z/2)

But alas, the algorithm as it is doesn't work, needs a complete rewrite.
At the time I thought of specifying constraints for the match in the name of the variable, for example to match only a numeric expression you would write '.X_N' or something like that. This would cause the engine to only match .X with a number. Now I think it could be attributes, but attributes are not visible so it becomes less readable.
Using attributes, you'd write the rule using '.X' and then use attribute commands to make '.X' a real number constant in the rule expression. But when you read the expression on the screen, you don't see the attributes so it's not immediately evident that the rule will only match numbers, so perhaps is not a good idea.
In any case, it will be a while before I get my hands on the CAS again.
 « Next Oldest | Next Newest »