RETURN(expr) operator inside a function

RETURN(expr) operator inside a function - Messages

#1 Posted: 2/28/2014 11:32:06 AM
Igor Skarine

Igor Skarine

14 likes in 97 posts.

Group: User

As usual, something doesn't work in freshly written function code.
The most useful feature for debugging is ability to dump indexes, intermediate results and e.t.c.
In Mathcad_11 I always used a command like "return(M) if (1)", where M was a matrix filled with variables I wanted to see.
It seems not very difficult to implement "return()" in Smath as well.
Of course, there is a workaround by means of using "if" operators, but nested IFs make function code unnecessary complicated and hard to remove when debugging is done.
And I actually hate typing to many characters and use multiple "line" operators :d .
Regards,
Igor

P.S. Another time saving feature for debugging is STOP operator. In Verilog you can use $stop to terminate simulation at desired point.
#2 Posted: 2/28/2014 11:48:27 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Never tried trace() ?
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 2/28/2014 11:56:30 AM
Igor Skarine

Igor Skarine

14 likes in 97 posts.

Group: User

You are right, I didn't use trace() so far.
I started to use Smath recently mostly because of it symbolic nature.
But I'm still keeping some old Mathcad habits.
I hope that return() is useful anyway. In many cases it simplifies the code a lot improving readability.

Trace() is nice feature, but sometimes it is useful to prematurely terminate or pause function execution.
Let say "return(trace(xxx))" or pause(trace(xxx)) is very useful as well.

Davide, do you know how to distinguish symbolic/numeric optimization without clicking on "Optimization" tub ?
Is there a way to assign different background/color/font to expressions evaluated symbolically ?

Regards
#4 Posted: 2/28/2014 2:25:15 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Actually there's not a fast way to distinguish between symbolic/numeric evaluation, there are several proposal in this section or scattered in the forum...

Math formatting actually is available at low-level only (plugins) I don't know if there are magic attributes to set in the xml code...
When I have enough time this feature will be added in my TableRegion plugin...

BTW the return function is not a bad idea.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • New Posts New Posts
  • No New Posts No New Posts