Post Reply 
Program without using variables?
10-03-2023, 09:04 PM
Post: #1
Program without using variables?
I am going down a few rabbit holes at the moment and I am exploring the idea of how to take numbers from the stack and use them in a program without storing them to a variable.

Yes, I know about local variables -> a b /<< a b + />> and I use them a lot.

The program I am writing now has six soft menu keys. 1 - 4 store a number from the stack into a variable. 5 executes the program. 6 cleans the variables from memory when I am done evaluating different numbers.

My first thought was to use a list. I place a list on the stack and when I press soft menu keys 1-4 it would store that number in the list on the stack in the appropriate order. This worked well, minus having to have the list on the stack.

Is there a different way to store variables without committing them to memory?

HP48GX, HP42s and DM42.
Find all posts by this user
Quote this message in a reply
10-04-2023, 02:39 AM
Post: #2
RE: Program without using variables?
argc, argv[ ] ?

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
10-04-2023, 12:29 PM
Post: #3
RE: Program without using variables?
Try storing numbers in a matrix.
Find all posts by this user
Quote this message in a reply
10-04-2023, 05:53 PM
Post: #4
RE: Program without using variables?
Find CMAT on hpcalc.org.

"CMAT is an HP48 program for performing operations on columns of a
matrix. CMAT iterates over each row of the matrix, treating the n
columns of the matrix as if they were variables named C1, C2, ...
Cn, or, optionally, as if they were named with user-specified
names."
Find all posts by this user
Quote this message in a reply
10-04-2023, 09:12 PM
Post: #5
RE: Program without using variables?
(10-04-2023 05:53 PM)MNH Wrote:  Find CMAT on hpcalc.org.

"CMAT is an HP48 program for performing operations on columns of a
matrix. CMAT iterates over each row of the matrix, treating the n
columns of the matrix as if they were variables named C1, C2, ...
Cn, or, optionally, as if they were named with user-specified
names."

Does a matrix allow (x,y) points to be stored in one position?

What do you use as a data collector these days? I used an HP48GX like most everyone in the early 2000s. I still have my gun and 48 with cards.

HP48GX, HP42s and DM42.
Find all posts by this user
Quote this message in a reply
10-04-2023, 10:26 PM
Post: #6
RE: Program without using variables?
(10-04-2023 09:12 PM)DM48 Wrote:  Does a matrix allow (x,y) points to be stored in one position?

Yes, if you use a complex matrix. The commands R\->C and C\->R can be used to combine two real matrices into a complex matrix and vice versa.
Find all posts by this user
Quote this message in a reply
10-05-2023, 12:38 AM
Post: #7
RE: Program without using variables?
(10-04-2023 10:26 PM)John Keith Wrote:  
(10-04-2023 09:12 PM)DM48 Wrote:  Does a matrix allow (x,y) points to be stored in one position?

Yes, if you use a complex matrix. The commands R\->C and C\->R can be used to combine two real matrices into a complex matrix and vice versa.

Fascinating!

HP48GX, HP42s and DM42.
Find all posts by this user
Quote this message in a reply
10-05-2023, 11:38 AM
Post: #8
RE: Program without using variables?
(10-04-2023 09:12 PM)DM48 Wrote:  What do you use as a data collector these days?

Topcon FC-5000 with MAGNET Field software.
Find all posts by this user
Quote this message in a reply
10-05-2023, 11:47 AM
Post: #9
RE: Program without using variables?
(10-04-2023 10:26 PM)John Keith Wrote:  Yes, if you use a complex matrix.

Could DM48 use a 3-D vector to store (x,y,z) points?
Find all posts by this user
Quote this message in a reply
10-05-2023, 02:51 PM
Post: #10
RE: Program without using variables?
(10-05-2023 11:47 AM)MNH Wrote:  Could DM48 use a 3-D vector to store (x,y,z) points?

Sure, or an n X 3 matrix to store a collection of points. The 48G has commands for extracting, inserting and replacing rows so that should be fairly easy and efficient.
Find all posts by this user
Quote this message in a reply
10-07-2023, 02:26 AM
Post: #11
RE: Program without using variables?
This post sparked a memory of a program that I used to use.

   

Please go to page forty-one of the manual. You will see that the author of the program uses a matrix to store points.

   
Find all posts by this user
Quote this message in a reply
10-20-2023, 01:04 PM
Post: #12
RE: Program without using variables?
Quote:Is there a different way to store variables without committing them to memory?
Keep in mind that the numbers are in memory whether they're on the stack or in a variable. The variable takes a little more space for the name and some overhead.

What you're doing sounds to me like a classic example of what directories for are. Create a directory for the program to run in. Store the variables in that directory. I don't recommend putting them on the stack because the user might modify the stack between pressing the soft keys.
Find all posts by this user
Quote this message in a reply
Post Reply 




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