1 Pages (3 items)
bug in if() - immediate evaluation behind line() - Messages
#1 Posted: 3/26/2022 8:49:18 AM
#2 Posted: 3/26/2022 9:18:52 PM
WroteHi!
Is this a bug in if()?
It turns to a real problem e.g. when used in a case like shown in the example
Yes, it is a bug.
if() function doesn't like plotting, solvers, custom functions as in your example, etc.
You have to use cases() for that kind of usages.
Regards
#3 Posted: 3/29/2022 6:08:28 AM
Just to clarify, this is not a fault in the specific function, it works this way because the current architecture of the core doesn't allows a different implementation (thus can't be simply fixed with a change in the function itself).
if(...) currently requires the condition argument to be defined on evaluation, otherwise an error is thrown; this makes the if/else instructions sealed from further evaluations of the preprocessor.
As opposite cases(...) doesn't throw errors on simbolic conditions, but this makes instructions evaluable (thus you shouldn't add any definition in the case() arguments).
if(...) currently requires the condition argument to be defined on evaluation, otherwise an error is thrown; this makes the if/else instructions sealed from further evaluations of the preprocessor.
As opposite cases(...) doesn't throw errors on simbolic conditions, but this makes instructions evaluable (thus you shouldn't add any definition in the case() arguments).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
sergio 3/29/2022 10:15:00 AM
1 Pages (3 items)
-
New Posts
-
No New Posts