newRPL: Named subroutines proposal
|
10-16-2015, 02:19 AM
Post: #12
|
|||
|
|||
RE: newRPL: Named subroutines proposal
(10-15-2015 10:07 PM)Helix Wrote: So, just to understand, what would be the syntax with my example: If you want Z to have the expression: 'A+SIN(B)+C', then: 'Z=A+SIN(B)+C' DEFINE This would work as if your flag -3 is set to symbolic. If you want the variables to be evaluated before defining Z, then: 'Z=A.*SIN(B.)+C.' would recall A, B and C when executed in the runstream, and have their results replaced in the expression. This happens before execution knows what command will be next. By the time you reach DEFINE, the modified expression is in the stack, and that expression will be assigned to Z. This works similar to when you set flag -3 to numeric, except you actually control what you want evaluated or not. The flag can still be needed, but at the UI level. For example, we could have flag -3, but what it would do is every time you type a variable, it appends a dot, indicating you want the numeric result. In the end, it "forces" numeric results system-wide, but not because the commands are behaving different, it's because the input you are giving is different. Ideally, a program should behave in a deterministic way, as long as you provide identical input, it should produce identical output. For constants, the same syntax could work just as well (eliminating the need for flag -2). You type π and you get the symbolic constant π on the stack. You type π. and you get the number 3.141592.... on the stack. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)