CopyVar - 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: CopyVar (/thread-9019.html) |
CopyVar - webmasterpdx - 09-09-2017 11:58 AM Can anyone explain the difference between these 2 lines....in terms of what happens? A:=B; CopyVar(A,B); The docs say the second line copys the storage area that B holds into A's storage area. I see no difference between that an A:=B;..... Alternatively, give me an example where they would not be the same... Ultimately, what I'm trying to figure out is defined in this post... http://www.hpmuseum.org/forum/thread-9018.html ....but nobody's answered it yet... Thx -Donald RE: CopyVar - Joe Horn - 09-09-2017 01:39 PM (09-09-2017 11:58 AM)webmasterpdx Wrote: Can anyone explain the difference between these 2 lines....in terms of what happens? The difference is that CopyVar doesn't evaluate the source variable. Here's a CAS example: aa:='1+2' <-- this stores the algebraic expression '1+2' into aa. bb:=aa <-- this stores the evaluated result, 3, into bb. CopyVar(aa,cc) <-- this stores the unevaluated expression '1+2' into cc. RE: CopyVar - ji3m - 09-09-2017 03:01 PM This behaviour is actually quite insane. Is it xcas or just fancy thinking. It make assignment equivalentto eval. No language I know does this. It make programming a nightmare. Sorry but it's crazy stuff. A:=B is not the same as evaluating argument in a function call. RE: CopyVar - webmasterpdx - 09-09-2017 10:04 PM Thank you. Now I understand what they meant. -Donald RE: CopyVar - Tim Wessman - 09-11-2017 03:12 PM You are looking at this from a "programming language" perspective. However, neither the HP language nor the CAS is really a "programming language" but rather a math language to represent mathematics. Most math languages and numerical systems do behave this way and you prevent evaluation through use of other functions, quoting arguments, etc. |