Deleting Variables
|
11-07-2016, 02:07 AM
Post: #1
|
|||
|
|||
Deleting Variables
Does anyone know how to delete a group of variables such as the one created below? Not just the content of the variables.
purge(a,b,c,d...) seemingly only works for CAS variables but not user types. EXPORT a:=0; EXPORT b:=0; ........ ........ EXPORT z:=0; EXPORT lowercaseVars() BEGIN END; Thank you. BM |
|||
11-08-2016, 03:47 AM
Post: #2
|
|||
|
|||
RE: Deleting Variables
To restart all your variables you can compile your program again with:
Programs ("name"): = Programs ("name"); "Name" is the name of the program you are in. You place it at the end of your main function, at the end. Viga C | TD | FB |
|||
11-08-2016, 05:11 AM
Post: #3
|
|||
|
|||
RE: Deleting Variables
Hello,
Purge is effectively erasing the variables (ie, they stop existing). This only work in CAS because in home mode variable that are declared always exist (such as EXPORTED variables). In home, you can reset them to 0 if you want. a:= b:= c:= d:= 0; should do it. Programs ("name"): = Programs ("name"); called IN the program will work, but is way way slower, and I hope that you realize that by doing so you are sawing the branch that you sit on as the program self modifies! Truthfully, I am impressed that it even works! Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
11-09-2016, 02:45 AM
Post: #4
|
|||
|
|||
RE: Deleting Variables
Thank you both for the reply. But let me make myself a little clearer.
If I enter on the command line: 22 Sto AB, 44 Sto BC, 66 Sto CD. I just created three variables + contents 22,44 and 66. On the command line I can type 8xAB and get answer 176. Now if I press Vars, User, then scroll to User Variables, Press Enter the three variables are displayed. 1 AB 2 BC 3 CD If I highlight each variables in turn, I can delete not only the content but the variable itself by pressing the <x] key. Now if I create a variables in a program called EXPORT XYZ() using the command EXPORT AW:=0; the variable AW cannot be deleted with the <x] key and seems to be permanent and cannot be deleted anymore than variables A to Z or M1 to M0, you can only change their content. It seems to me that if I create a program that contains say 150 variables created with the command EXPORT, those 150 variables become as permanent, as A to Z and M1 to M0, and cannot be deleted. Am I correct? Thanks again. |
|||
11-09-2016, 06:31 AM
Post: #5
|
|||
|
|||
RE: Deleting Variables
(11-09-2016 02:45 AM)BERNARD MICHAUD Wrote: Thank you both for the reply. But let me make myself a little clearer. EXPORT makes the variable available from the outside. If you want to use internal variables just use LOCAL instead of EXPORT My website: ried.cl |
|||
11-09-2016, 06:36 AM
Post: #6
|
|||
|
|||
RE: Deleting Variables
Hello,
You are partially correct. They are n types of variables in prime. System wide A, B, C.... They are accessible from anywhere, anytime, non erasable, and of fixed type. To this, you can add system configurations variables such as TOff, HAngle... The purpose of these vars is for quick math, conserving values when switching from one context to another one (and of course system configuration). User created system wide variable. They behave and act like the system wide, but are NOT of fixed type and can be deleted (through the memory interface of DelVars). These are designed to let the user create variables with his preferred names when working on a problem. User created program variable. They can be of 2 sub-types. Exported or not. They are created when the program is compiled and last until the program is erased, or modified. They too behave like system wide variable, but are not of fixed type. These are designed for the programmer as program global variables, to allow the program keep data in between calls and to let the programmer/user pairs exchange configuration information. A special note here to talk about program local variables. These are only available when a program is running, and only in the block where it was declared (and it's sub blocks within the function). Then, we get to apps. Any app variable (with the notable exception of the F1 and similar vars) are NOT accessible when the app is not active (unless fully qualified as in used with app_name.var_name). This can be confusing as 2 or more apps can have variables using the same name, but the current's app one will be used. Once again they come in 3 flavors: System (ie,the vars that are build in, not erasable, usually of fixed type, sometimes used for configuration (XMin for example)). Add to this User create app variables (Created/deleted using AVars DelAVars) which are like system wide user variables, but are only active (unless fully qualified) when the app is active. And finally the user created app program. Same deal as with program variables, BUT app limited. And this is all for the home screen. Then we have the CAS variables. These are much more like mathematical variables. In the fact that you do not need to declare them. You can either use a variable name as an identifier (ie a name that is NOT a placeholder for a given math object, but just a random operand), or a variable (ie: a name that is a placeholder for a given math object, number that might change but which does exists). They are system wide, and usually lowercase. I hope that this helps (although it will most likely confuse you even more at first). Please do understand that each of these variables have their own use and 'raison d'être' and are there for a very good reason. They do represent various concepts, uses and needs. But yes, it can be confusing at first. Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
11-09-2016, 08:46 AM
(This post was last modified: 11-09-2016 08:58 AM by Didier Lachieze.)
Post: #7
|
|||
|
|||
RE: Deleting Variables
(11-07-2016 02:07 AM)BERNARD MICHAUD Wrote: Does anyone know how to delete a group of variables such as the one created below? Not just the content of the variables. Normally exported variables are supposed to stay to be available and usable outside of your program. Now if what you want to achieve is to have them created and visible only when you want to run a specific application composed of a set of programs, this can be done programmatically by putting all exported variables in a separate program dynamically created. Here an example which creates a program called “GlobVars” with 3 exported variables, after that the exported variables exist and are available. If you call it a second time it will delete “GlobVars” and the exported variables. Code: EXPORT TestGlobVars() EDIT: note that it will make checking and compiling your program a bit tricky as the global variables should exist at that time. |
|||
11-10-2016, 02:18 AM
Post: #8
|
|||
|
|||
RE: Deleting Variables
Thank you very much to all of you gentlemen. You have all given me an insightful experience in the world of hp prime variables handling. I think that the best approach I have deduced from your replies is this.
Create two programs. Say FiberOptics.hpprgm and a separate program FOVars.hpprgm, that contain only the variables. EXPORT FOVars() BEGIN END; next create the program FiberOptics.hpprgm Export fiberoptic() Start(SolveApp) etc.. code END; Archive both and when needed load them unto the calculator. To delete the variables simply delete FOVars.hpprgm and all those variables disappear with the FOVars program. Thank you so much. PS: Will in the future the Solver App be able to process Complex Numbers. It would be a great asset to the Prime if we could use the Solver to create Libraries for Engineering |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)