Post Reply 
No way to get an element free of brackets
02-17-2021, 06:26 PM
Post: #8
RE: No way to get an element free of brackets
(02-17-2021 05:02 PM)Albert Chan Wrote:  
(02-17-2021 10:48 AM)Didier Lachieze Wrote:  Here is a simplified way to use lists to assign values to global variables, not requiring CAS ...

FYI, assignment via expr() might assign to local variable instead, if it exist.

EXPORT test()
BEGIN
local a := 123;
expr("a := 456");
return a;
end;

CAS> test()
456
CAS> a
a

Compared to Python, which can easily assign global variables.
(OTTH, this might not be a good thing ...)

>>> def test(): a = 123; globals()['a'] = 456; return a
...
>>> test()
123
>>> a
456

----------------------

My gold was to store numerical values enclosed in list by variables enclosed in list.
Especially when the variables are unknown in memory ahead. Until now I thought it impossible to do this without declaring each variable ahead in the program. Now possible doing what I want, my gold has been fulfilled. There's a lot of Input in solving cad. And would be very time consuming storing every single input the way you show this time. Still nothing compares to William Wickes
RPL HP48GX, HP50 programming tool in this sort of work. And it's a sad behavior excluding this programming tool from the Prime. With the faster running of Prime, it should be there. The only thing that could be better was the lack of symbolic in vector and matrix calculations. Fortunately, these calculations could be done in lists.

essen
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: No way to get an element free of brackets - essen - 02-17-2021 06:26 PM



User(s) browsing this thread: 1 Guest(s)