Compacting syntax?

Compacting syntax? - Messages

#1 Posted: 7/10/2018 6:59:22 PM
Dionysios J. Pantazis

Dionysios J. Pantazis

16 likes in 179 posts.

Group: User

I have an include file with a bunch of functions and variable definitions in it. Within one of my functions is a 'cases' and a bunch of if/thens that makes it REALLY long.

Are better ways to script or format the syntax for something like this? The sheer vertical size of this trips me up sometimes and I need to get my bearigns to navigate it.

Thanks

Dennis

include-detail.png




Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#2 Posted: 7/10/2018 9:13:29 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Are better ways to script or format the syntax for something like this ?



For horizontal, use if/otherwise instead of if/else
Open the collapsed area [mapR(x), mapG(x),mapB(x)].

Image Rainbow Colormap [Electron].sm (252 KiB) downloaded 36 time(s).

#3 Posted: 7/10/2018 10:09:10 PM
Dionysios J. Pantazis

Dionysios J. Pantazis

16 likes in 179 posts.

Group: User

Jean Giraud-

THANK YOU! that will help me make things so much cleaner. I need to take some time to get my head around the way I have it now to clean up.

Question- at the value of say 64, do the sucessive (32≤x)&(x≤64) and (64≤x)&(x≤96) have a conclict? should one of those terms be a less than instead of a less than or equal too operator?

Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#4 Posted: 7/10/2018 11:22:22 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Question- at the value of say 64, do the sucessive (32≤x)



... can't tell w/o the document. On top, you complicate matters
Can't you mange f(x) ... linterp(X,Y,x)
... or part of the document that produces something.
#5 Posted: 7/11/2018 11:19:35 AM
Dionysios J. Pantazis

Dionysios J. Pantazis

16 likes in 179 posts.

Group: User

Jean Giraud-

My question is about the bolean expressions in your example, within the mapR(x) section. Two sucessive expressions have a common intersection point throughout.

1. The upper limit of the first expression is a less than or equal evaluation of a number.

2. The lower limit of the next expression is a greater than or equal to the same number.

What happens when the value for the expression is exactly equal to the number?

I thought only one of the two expressions could be an 'equal to' statement at the same limit point.

Dennis

Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#6 Posted: 7/11/2018 1:14:55 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... mistakes in the last two posts, deleted.
The two segments for interpolation.

Dennis.sm (11 KiB) downloaded 30 time(s).
#7 Posted: 7/13/2018 9:44:53 PM
Dionysios J. Pantazis

Dionysios J. Pantazis

16 likes in 179 posts.

Group: User

Jean Giraud-
Thanks for that explanation. I actually learned a whole bunch more functions from that too!
Dennis
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#8 Posted: 7/14/2018 1:54:32 AM
Oscar Campo

Oscar Campo

124 likes in 298 posts.

Group: Moderator

Wrote

I have an include file with a bunch of functions and variable definitions in it. Within one of my functions is a 'cases' and a bunch of if/thens that makes it REALLY long.

Are better ways to script or format the syntax for something like this? The sheer vertical size of this trips me up sometimes and I need to get my bearigns to navigate it.



You can use areas to separate portions of code.

As an example, please, look this game that I developed and has a lot of lines of code

Regards!
  • New Posts New Posts
  • No New Posts No New Posts