HP Forums
50G variable issue - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: 50G variable issue (/thread-222393.html)

50G variable issue - Matt Agajanian - 05-21-2012

Hello all.

I'm having a devil of a time on this 50G with the simplest thing. So, I'd like some help. Thanks.

Why would this:

<< -> a b >> give me a 'Syntax Error' after I press ENTER as I just try to write this beginning steps of a program to see if I'm using the -> function correctly? Even when I try << -> 'a' 'b' >> , I get the same Syntax Error message.

Does my 50G need certain flags set? Are there certain libraries, functions or a reset/restore of the calc to its factory state that I need to perform?

As I've not programmed a 48GX in at least three years, I am quite a bit rusty.

Re: 50G variable issue - Alexander Oestert - 05-21-2012

<< -> A B << >> >>

The inner << >> are for the program to be written in.

Edited: 21 May 2012, 2:32 p.m.

Re: 50G variable issue - Matt Agajanian - 05-21-2012

Thanks! Relief!! Okay, so now the question is after local vars are created/consumed by the -> command, why must the next step always be << program >> instead of just coding the rest of the program even though the first set of << >> is already there?

Re: 50G variable issue - Kiyoshi Akima - 05-21-2012

You need the inner set of brackets to delineate the scope of the variables. There's nothing to prevent you from having more than one inner set.

-> a b
* do some stuff here to calculate two values
-> x y
* do some stuff with the two new values

You can also nest deeper.

-> a b
* do some stuff
-> x y
* do some stuff with a, b, x, and y
* do more stuff with a and b

Re: 50G variable issue - Matt Agajanian - 05-21-2012

Thanks for the refresher course. Yes, I could scope out one of those 'An Easy Course In...' but, since Educalc is now relegated to my MoHPC DVD, perhaps I could pour myself into the 28 manual as well as the myriad of 28 app packs there and learn by example. Would anyone here know where I could pick up some of those books so manufactured in the days of EduCalc and the 28 run?

By the way, has EduCalc resurfaced here on the web under another name perhaps? Could the EduCalc.net website be a remarketed/repackaged EduCalc or is it something different?

Re: 50G variable issue - Bart (UK) - 05-21-2012


You can also use an algebraic expression directly after the local variable command, eg:
<< -> a b 'a^2+a*b+b^2' >>

Anyway, it's about the scope in which local variables exist. See the AUR chapter 1 section "Using Local Variables" (p1-7 i think).


Re: 50G variable issue - C.Ret - 05-21-2012


Right, inner sub-program structure and local variables allow a lot of fun in RPL.

But the « -> a b « ... » » structure is not the only possible way.
One useful structure with local variable is the 'user function'. In contrary of program/sub-program structure, 'user function' permits algebraic or symbolic evaluations, derivations and integrations.
Simply replace the unique inner « ... » sub-program structure by an algebraic expression '...a...b...'

Having two types of local variables structures also explain a inner structure (program or algebraic object) is needed.

« -> a b 'a^2+a*b+b*b' »

P.S. Bart's message meets mine in the Internet Wires !

Edited: 21 May 2012, 3:14 p.m.

Re: 50G variable issue - Matt Agajanian - 05-21-2012

So, in all context, -> is more a local variable mechanism in contrast to a global variable creation mechanism.

And Bart, you are correct, indeed! Page 1-7 is EXACTLY where the dissertation on Local Variables begins! Well done!

Edited: 21 May 2012, 3:51 p.m.

Re: 50G variable issue - David Hayden - 05-21-2012

Would anyone here know where I could pick up some of those books so manufactured in the days of EduCalc and the 28 run?

Try the "HP 48 Insights" books. They're right there on the MoHPC DVDs. I'm reading them now and find them very helpful.

For example, any variable that starts with a left arrow is automatically a local variable.

Also, executing a local variable always just returns it to the stack. If the variable contains a program that you wish to execute, you must add an EVAL instruction.