Post Reply 
CopyVar
09-09-2017, 11:58 AM
Post: #1
CopyVar
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
Find all posts by this user
Quote this message in a reply
09-09-2017, 01:39 PM
Post: #2
RE: CopyVar
(09-09-2017 11:58 AM)webmasterpdx Wrote:  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...

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.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-09-2017, 03:01 PM
Post: #3
RE: CopyVar
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.

I work with android Prime only for now on my
Galaxy Tab Pro/Note 2
Find all posts by this user
Quote this message in a reply
09-09-2017, 10:04 PM
Post: #4
RE: CopyVar
Thank you. Now I understand what they meant.
-Donald
Find all posts by this user
Quote this message in a reply
09-11-2017, 03:12 PM
Post: #5
RE: CopyVar
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.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
Post Reply 




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