HP Forums
How can you get all CAS variable names in a list? - 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 can you get all CAS variable names in a list? (/thread-17927.html)



How can you get all CAS variable names in a list? - IHarwell - 01-13-2022 09:01 PM

In xcas, you can get a list of names for all defined CAS variables using the VARS function. How would you do such a thing with the HP Prime?

If there's no way to do such a thing, how would I file a feature request for it? This function is really quite important for more advanced programs and should be extremely easy to toss in. Practically all of the necessary code already exists, as they provide the CAS variable list in the "Mem" screen.

For reference for those unfamiliar, here is a link to the xcas documentation:
http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/en/cascmd_en/cascmd_en060.html#ssec%3AVARS

In order to work on the Prime, the function might need a minor modification such that it returns the names as strings in the list.

For instance, rather than {x,y,f,k}, it would return {"x","y","f","k"}.

I also noticed that the VARS function itself was removed for the Prime. Does anyone know why?


RE: How can you get all CAS variable names in a list? - parisse - 01-14-2022 05:45 AM

As you can guess, it was not me. The code exists, but VARS was removed from the keywords list recognized by the parser.


RE: How can you get all CAS variable names in a list? - IHarwell - 01-14-2022 09:40 AM

(01-14-2022 05:45 AM)parisse Wrote:  As you can guess, it was not me. The code exists, but VARS was removed from the keywords list recognized by the parser.

Interesting. Thank you for the response.

By the sound of it, it seems unlikely that the feature would be added back in, then. I'm struggling to understand why it was removed at all.

The lack of this one feature is presently the only thing preventing me from implementing a CAS serialization workaround.

All it would take is a list of names of the variables. From those, you just need to wrap it all up with [name]+":="+CAS.eval([name]), put those strings in a list on Home view, and save the Home view. To load, you just go through the list with CAS(eval([list entry])) commands to reconstruct the CAS variables.

It's not quite as complete as the full stack restoration you get with Home view, but it's better than nothing.


RE: How can you get all CAS variable names in a list? - Thomas_Sch - 01-14-2022 10:05 AM

(01-14-2022 09:40 AM)IHarwell Wrote:  ...
Interesting. Thank you for the response.

By the sound of it, it seems unlikely that the feature would be added back in, then. I'm struggling to understand why it was removed at all.

The lack of this one feature is presently the only thing preventing me from implementing a CAS serialization workaround.
Hi,

please post your request to the new responsible for the HP calculators, Klaas Kuperus from Moravia, see https://www.hpmuseum.org/forum/thread-17593-post-153940.html#pid153940 e.g. by PM,
and please repost the answers and maybe corrections here.

Thank you!


RE: How can you get all CAS variable names in a list? - ftneek - 06-08-2024 05:41 AM

Has anyone discovered a method to access a list of CAS variables on the Prime?


RE: How can you get all CAS variable names in a list? - hp-zl - 06-08-2024 07:31 AM

Shift – Mem ("B" key)
CAS Vars
Enter


RE: How can you get all CAS variable names in a list? - ftneek - 06-08-2024 02:04 PM

Thanks, but I should have been a little more specific. I’m looking for a way to access a list of CAS variables and do some manipulation on the list/variables from a program, like how HVars returns a list of home variables.


RE: How can you get all CAS variable names in a list? - parisse - 06-08-2024 04:44 PM

I made a change so that the VARS command become visible.


RE: How can you get all CAS variable names in a list? - ftneek - 06-08-2024 05:21 PM

Thank you, now just have to wait for the update to be available Tongue