HP Forums
location of variable, Home or CAS? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: location of variable, Home or CAS? (/thread-14577.html)



location of variable, Home or CAS? - cdmackay - 02-27-2020 06:54 PM

Is it possible, within CAS, to identify the location of a variable, whether Home or CAS?

e.g for both a:=3 (Home) and a=3 (CAS), type() gives me INT for a, and IDENT for 'a'.

I know I can find them in separate areas in the Memory Manager (shift B), but I'd like to do it from a program.

I'd like to enhance the little varslist utility — posted here by @dae — to indicate the location, to speed up deleting it.

Of course, I could use purge(), and if it fails I know it's in Home, but…

thanks!


RE: location of variable, Home or CAS? - cyrille de brébisson - 02-28-2020 07:27 AM

Hello,

Sorry, I never thought of that!!!!

Symbols can be in LOTS of places in the system (see order of resolution)...

1) Local variables (CAS or PPL). Note that when calling the CAS from PPL, all the current PPL Local variables are accessible from the CAS (normally)
2) Current Program globals (variables declared out of the scope of functions)
3) App variables (AVars)
4) App build in variables (Xmax, Xmin...)
5) Other programs globals (exported, or not if fully qualified)...
6) Other apps globals (AVars and build in)...
7) Home and CAS global variables (including home build in: A-Z, Z0-Z9 + HVars)

Kind of messy! But they all have their roles...

Cyrille


RE: location of variable, Home or CAS? - cdmackay - 02-28-2020 10:16 PM

thanks Cyrille! I was considering only section 7, above, so thanks for the reminder Smile