[question]userRPL, functions or (sub)subprograms and directories
|
03-29-2017, 10:36 AM
(This post was last modified: 05-21-2018 12:51 PM by pier4r.)
Post: #1
|
|||
|
|||
[question]userRPL, functions or (sub)subprograms and directories
A basic program in userRPL that makes use of local variables and no algebraic expression is the following (If Im not mistaken)
Code:
Now when programs gets a bit more complicated (note1) I usually try to use functions to split it in blocks. As far as I know there are at least two ways to emulate a function: - either I produce functions in different source files, that then I save as programs. So I have: function1 <prog> function2 <prog> main <prog> Where main makes use of function1 and function2 - or I somehow type the function in the main program and the store it to use it as recalling a variable. Like Code:
Are there better ways? So far I prefer the second way (unless the program is awfully long, like 2Kb or more comments excluded) because I can use functions as defined in the main program, and not floating around the memory and maintained separatedly. Nevertheless I do not know if there may be cases that a variable cannot hold a program. I tried to search on this site but I get interesting but not useful discussions like this. (note 1) yes I know, ideally I should move to sysRPL or hpGCC or maybe the lua interpreter built with hpgCC, but I did not finish exploring the RPL commands in the AUR) Wikis are great, Contribute :) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)