Post Reply 
HP49-HP50 Lists of combination
12-19-2022, 12:38 PM
Post: #5
RE: HP49-HP50 Lists of combination
From the HP 48G Series Advanced User’s Reference Manual p. 1-15:
Quote:Compiled Local Variables
Global variables use up memory, and local variables can’t be used outside of the program they were created in.
Compiled local variables bridge the gap between these two variable types.
To programs, compiled local variables look like global variables, but to the calculator they act like local variables.
This means you can create a compiled local variable in a local variable structure, use it in any other program that is called within that structure, and when the program finishes, the variable is gone.

There's nothing magical about using ←C: it just contains the recursive program.
But it allows to use itself inside the program, even though the assignment was made outside.

We could have used a global variable comb instead and used that.
The benefit would be that it could be easily invoked without using EVAL.
However, if someone decided to use a different global variable name, the program had to be adjusted.
Using a compiled local variable avoids this.

Using the debugger and stepping through the code with a small example can help to understand the code.
Also, I recommend reading the referenced blog post.
You can also try to implement the other two solutions.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP49-HP50 Lists of combination - Gil - 12-18-2022, 11:01 PM
RE: HP49-HP50 Lists of combination - Gil - 12-19-2022, 10:38 AM
RE: HP49-HP50 Lists of combination - Thomas Klemm - 12-19-2022 12:38 PM
RE: HP49-HP50 Lists of combination - Gil - 12-19-2022, 01:42 PM
RE: HP49-HP50 Lists of combination - Gil - 12-19-2022, 03:35 PM



User(s) browsing this thread: 1 Guest(s)