newRPL - build 1255 released! [updated to 1299]
|
04-19-2019, 01:39 PM
Post: #402
|
|||
|
|||
RE: newRPL - build 1089 released! [update:build 1158]
(04-19-2019 01:11 PM)compsystems Wrote: HelloNo, it wasn't because it does not apply in RPN/RPL. (04-19-2019 01:11 PM)compsystems Wrote: The RPN commands of the hp48 / 50 interpret a number of fixed arguments, while in the functional standard notation some languages the number of call arguments can be variableWrong: all commands in RPN/RPL are free to use how many elements (arguments) they want from the stack. (04-19-2019 01:11 PM)compsystems Wrote: I think the only way in RPN is to specify the number of argumentsWrong again, on all languages, each command/function knows how many arguments it needs depending on the values of other arguments or any other markers. In other languages you ARE providing the number of arguments when you enclose them in parenthesis. Of course you can do the same in RPL, just put a marker on the stack where the arguments start, everything below that is an argument. Code:
By the way, some RPL commands require different number of arguments depending on the type of arguments passed, some others even analyze the arguments to make a smart "guess" at how many arguments are needed (look at DOLIST in the AUR, on stock 50g it requires or not an explicit number of lists depending on analyzing the program you provided to see how many arguments it needs). This is also the same for other languages, printf() analyzes the string you passed on the first argument to see how many arguments it needs and their type. To close this: there's no need for anything special to do variable arguments in RPL. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)