HP Forums
how do you delete a list from a program - 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: how do you delete a list from a program (/thread-8907.html)



how do you delete a list from a program - webmasterpdx - 08-26-2017 09:28 AM

I tried purge(L1) but it doesn't work.
Any suggestions?
I need to do this as I want to use certain lists in my program but their size may vary depending on various factors, so I need to delete them or make them zero size initially.
Basically I want to do the same as deleting from the list editor, but from a program.
Thanks
-Donald


RE: how do you delete a list from a program - Didier Lachieze - 08-26-2017 10:09 AM

(08-26-2017 09:28 AM)webmasterpdx Wrote:  I tried purge(L1) but it doesn't work.
Any suggestions?

L1:={} or {}▶L1


RE: how do you delete a list from a program - webmasterpdx - 08-26-2017 08:28 PM

L1:={} seems to empty it out alright. So is the reason that purge doesn't work because L1 is a system preassigned variable name?
So purge will work with my own variable names, but for the system ones I need to use the method above.
Is this correct?
Thx
-D


RE: how do you delete a list from a program - webmasterpdx - 08-26-2017 08:46 PM

I found out how to do this finally in an obscure post via google.
purge(name) works for CAS variables.
For system builtin variables, use L1:={} to clear out the variable, but the variable itself can't be deleted.
For home user variables, or from a program, you can delete them using DelHVars("name").
This delete command doesn't appear to be documented anywhere. However it works. The quotes are necessary.


RE: how do you delete a list from a program - webmasterpdx - 08-26-2017 09:17 PM

Here is some more information on HVars and DelHVars()....
http://hpmuseum.org/forum/thread-4048.html

All User Variables are stored in a list called HVars. DelHVars(n) deletes the index into the HVars list (deletes that variable). DelHVars("name"), with the quotes, deletes the HVars variable of that name.


RE: how do you delete a list from a program - Tim Wessman - 08-27-2017 03:54 PM

Page 635 of the English manual. Also will be in the on calc help somewhere if you search for it I'm sure.


RE: how do you delete a list from a program - Carlos295pz - 08-27-2017 03:58 PM

(08-26-2017 08:46 PM)webmasterpdx Wrote:  This delete command doesn't appear to be documented anywhere. However it works. The quotes are necessary.

You can find the information in the calculator help.
[Image: 36447754030_f29cf909c0_o.png]


RE: how do you delete a list from a program - webmasterpdx - 08-27-2017 06:45 PM

The thing is, you go looking for deleting user variables, so I'm going to look under User Variables....not HVars or DelHVars.....that's called knowing where to look when you know the answer.
When you don't know the answer, you are going to look under User Variables or deleting variables. DelHVars isn't in the command list in the online documentation.....I did figure there might be a command that began with Del... but it isn't there.

So, sure, you can find the documentation when you know the answer, but when you don't, it's not intuitive.

Same with most of the obscure documentation. e.g. Statistics_1Var....I was trying to figure out how H1 was defined. Again, if you know the answer and that there is a section with the app variable definitions in the User manual, sure you can find it, but I looked in the intuitive area.....under the chapter for the Statistics_1Var app....not documented there, so I'm not going to find it.

However, now I know these areas are in the docs, so I should be able to find future obscure documentation as I know where to look.


RE: how do you delete a list from a program - Joe Horn - 08-27-2017 07:29 PM

(08-27-2017 06:45 PM)webmasterpdx Wrote:  The thing is, you go looking for deleting user variables, so I'm going to look under User Variables....not HVars or DelHVars.....that's called knowing where to look when you know the answer.

That's a good choice for what to search for, because if you press Help, Tree, Search, and type "user variables" into the search box, and check the "Find in content" box, it immediately lands on "HVars", and pressing Next goes to "DelHVars".

Help Tree Search is your friend.