newRPL - Updated to build 1510 [official build remains at 1487]
|
09-08-2021, 05:21 PM
Post: #183
|
|||
|
|||
RE: newRPL - Updated to build 1497 [official build remains at 1487]
I believe that a custom case structure is an overengineered solution, the simple command CKARG appears more reasonable (a building block that can be used in a normal case structure, or in a wholly different manner if you want).
If I may, I'd like to request replacing the simple true/false flag with an index of which type in the list matched (with 0 as placeholder for no match, like POS does). In RPL anything that isn't 0 counts as true anyway, so the value can be used for the same purposes, and performance-wise it should be a freebie, but in situations where the cases are similar but not quite the same the programmer could use this index to pull the type-specific handling code out of a list, then follow up with the common code. For instance, if your program shall accept a list or a vector and treat either as coordinates, that would allow something like this, based around AXL to coerce the input into one canonical format: Code: ... CKARGTF This kind of dispatching also opens the door to a third command that returns the index but retains the error-out on no match. In the end, CKARGTF would arrive at something like this UserRPL implementation: Code: \<< Code: \<< Side note: I'm a SysRPL programmer, but in >90% of my programs type-checking doesn't use CK&Dispatch1 or its siblings. It's not as awesome as it appears to be. Checking each stack level (or group of them, in some cases) in turns is where it's at. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)