Post Reply 
(50g) Store calculation result in different directory
06-06-2015, 12:17 PM
Post: #1
(50g) Store calculation result in different directory
I just recently started programing in UserRPL for the HP 50g calculator and I am having some trouble in making a program that stores its result (a numerical value) in a directory which is different from the one the program is stored in. Is there any way to do that? Any help is appreciated. Thanks in advance!
Find all posts by this user
Quote this message in a reply
06-06-2015, 02:37 PM
Post: #2
RE: (50g) Store calculation result in different directory
You seem to be confused the same way I was, and may be I still am.
Directories are not the same as for PCs. So for example if you have one variable in the ROOT and then CHDIR on another directory, the root variable is still visible, you can call it without any sort of path. This being said nothing prevents you from creating the same variable in the subdirectory and this one will be used instead of the ROOT one.
For that reason I don't think there anything like a path in the 50g.
Find all posts by this user
Quote this message in a reply
06-06-2015, 03:32 PM
Post: #3
RE: (50g) Store calculation result in different directory
Hello folks,

It's bit tricky:
For storing: value 5 should be stored in the variable A in the subdirectory dirsubsub:

first step
stack 1: {dirsub dirsubsub} EVAL @@changes current directory to dirsubsub

second step
stack 2: 5
stack 1: 'A' STO

third step
UPDIR UPDIR @@changes back to former directory

that is clumsy maybe someone else know a more comfortable way. If you want to store in upper directories, then change step 1 with step 3.

Recalling is much easier:

{dirsub dirsubsub A} RCL @@you get 5 without changing directory.
If you want recalling a value from a upper directory then you have to use UPDIR and pathlist with EVAL for coming back to current directory.

Maybe some filer programs on hpcalc.org have easier commands for handling this situations.
Last info: every dirname is a file its content can be displayed be 'dirname' RCL

Greetings peaceglue
Find all posts by this user
Quote this message in a reply
06-06-2015, 03:48 PM
Post: #4
RE: (50g) Store calculation result in different directory
(06-06-2015 02:37 PM)Tugdual Wrote:  if you have one variable in the ROOT and then CHDIR on another directory, the root variable is still visible, you can call it without any sort of path.

I had no idea about that and it seems to be really helpful.

(06-06-2015 03:32 PM)peacecalc Wrote:  Hello folks,

stack 1: {dirsub dirsubsub} EVAL @@changes current directory to dirsubsub

Recalling is much easier:

{dirsub dirsubsub A} RCL @@you get 5 without changing directory.
If you want recalling a value from a upper directory then you have to use UPDIR and pathlist with EVAL for coming back to current directory.

Thats what I was just looking for! Thanks for the info!

Greetings,
galloafro
Find all posts by this user
Quote this message in a reply
06-07-2015, 03:05 AM
Post: #5
RE: (50g) Store calculation result in different directory
(06-06-2015 03:32 PM)peacecalc Wrote:  It's bit tricky:
For storing: value 5 should be stored in the variable A in the subdirectory dirsubsub:

first step
stack 1: {dirsub dirsubsub} EVAL @@changes current directory to dirsubsub

second step
stack 2: 5
stack 1: 'A' STO

third step
UPDIR UPDIR @@changes back to former directory

that is clumsy maybe someone else know a more comfortable way. If you want to store in upper directories, then change step 1 with step 3.

Instead of
{dirsub dirsubsub} EVAL 5 'A' STO UPDIR UPDIR
I would suggest
PATH dirsub dirsubsub 5 'A' STO EVAL

Two things to notice here. (1) To jump into a directory, just say its name. No need to put it in a list and EVAL the list. If name ambiguity is possible, execute HOME before the first directory name. (2) You can return to your original path at any time, no matter what path changes you've made, by starting with PATH, and ending with EVAL, because that executes (and therefore restores) the original path. No need for multiple UPDIR's.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-07-2015, 09:07 AM (This post was last modified: 06-07-2015 12:35 PM by peacecalc.)
Post: #6
RE: (50g) Store calculation result in different directory
Hello Joe,

Thank you very much for your additional information. I use your hlp49 lib with great profit on my hp 50g, for this a great thank you, too.
Find all posts by this user
Quote this message in a reply
Post Reply 




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