Change the way LOCAL variable declaration works.
|
06-10-2014, 02:34 PM
Post: #5
|
|||
|
|||
RE: Change the way LOCAL variable declaration works.
(06-10-2014 06:01 AM)cyrille de brébisson Wrote: Hello, My problem was: I wanted to declare LOCAL variables from an expression as an argument to my prog. totaly independent of waring what the vars. in the expression were. I just wanted give to the program an expressin and some values corresopnding to the variables as an array and the program would evaluate and/or substitute those values in the expressin. Depending on the number of rows in the array of values I would get list of numbers and/or new expressins with something substituted for variables if I wanted to. Of course the values would have to have an order that would correspond to the variables in alphabetical order, the program would take care for sorting the extrakted variable. All should happen without me woring what the variables and in what order they were in the expression and everything would happen in the scope of the program so at the end I would get the list of values/expressins and no garbage left outside of the program. To do that I needed to declare the extracted variables from the expressin as a LOCAL variables and that did not work because whenever I took a variable from the variables list and try to do it as LOCAL I was getting an error. I wanted to suggest, in my post, to make the LOCAL declaratin more flexible so it would accept and declare as locals variables from some list witout an error ex. LOCAL vars(1), vars(2) etc. LOCAL accepts for example x or x={} etc why it can not accept for example vars(1) and take whatever vars(1) is as long as it evaluates to a variable. That should not be to difficult to impliment, I think. I solved the problem using Han's explanation for creating CAS variables but they are stored as global vars but that is not a big problem because at the end I can purge them. The program I wrote works quite well and is olomost 98% what I wanted. I would also like to mention thet the command in HP Prime 'algvar' is not 100% perfect. It works as expected when I use 'algvar(z+x+y)' and gives [[z,x,y]] but when the expression is SIN(z)+y+x 'algvar(SIN(z)+y+x)' gives as variables [[SIN(z),y,x]] and that is not correct because SIN(z) is a funktion not a variable z is the variable. Thank you Cirill for your time to answare my post, much appreciated. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Change the way LOCAL variable declaration works. - John P - 06-08-2014, 05:28 PM
RE: Change the way LOCAL variable declaration works. - Han - 06-08-2014, 06:45 PM
RE: Change the way LOCAL variable declaration works. - John P - 06-08-2014, 07:11 PM
RE: Change the way LOCAL variable declaration works. - cyrille de brébisson - 06-10-2014, 06:01 AM
RE: Change the way LOCAL variable declaration works. - John P - 06-10-2014 02:34 PM
RE: Change the way LOCAL variable declaration works. - Tim Wessman - 06-10-2014, 03:21 PM
RE: Change the way LOCAL variable declaration works. - John P - 06-10-2014, 04:09 PM
|
User(s) browsing this thread: 1 Guest(s)