cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Boolean And - one question

ValeryOchkov
24-Ruby IV

Boolean And - one question

Is it an Error or one property of Mathcad (as in BASIC or Pascal, not C)?

And.png

If 2>3=0 why we must check one more second operand!?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Valery,

Mathcad doesn't appear to implement lazy evaluation(*), except in specific instances (such as the boolean operators). Your function And is a standard function, so Mathcad evaluates both arguments of your function And before calling it.

I suspect that the 3<i comparison might be picked up as a static type incompatibility, ie it's done at compile time rather that during execution, which is why Mathcad doesn't seem to follow the boolean non-evaluation rule.

However, I do agree that it would be good to implement lazy evaluation and some form of memoization..

Stuart

Note:

(*) Lazy Evaluation (Russian)

Lazy Evaluation (English)

View solution in original post

2 REPLIES 2

Hi Valery,

Mathcad doesn't appear to implement lazy evaluation(*), except in specific instances (such as the boolean operators). Your function And is a standard function, so Mathcad evaluates both arguments of your function And before calling it.

I suspect that the 3<i comparison might be picked up as a static type incompatibility, ie it's done at compile time rather that during execution, which is why Mathcad doesn't seem to follow the boolean non-evaluation rule.

However, I do agree that it would be good to implement lazy evaluation and some form of memoization..

Stuart

Note:

(*) Lazy Evaluation (Russian)

Lazy Evaluation (English)

Thanks, Stuart!

I must do so - see the picture and one IAPWS web-sheet

http://twt.mpei.ac.ru/MCS/Worksheets/iapws/IAPWS-IF97-Region3-VPT.xmcd

ps.png

Top Tags