Gen~ [expr] syntax

Igneous Rock's icon

Hey All,

I'd really appreciate a helping hand, I'm at a standstill. I am working in a larger gen~ patch, involving triggering a loop if the playback pointer if outside of a certain window. I typed up a nice little expr object that works when I test it in a regular patch, but when I try the gen~ version inside of my patch, I am constantly getting two error messages saying "expr missing ')'", and I can't figure out where I'm missing a parenthesis. More importantly, I'm not really clear on the order of operations in expr, and when parenthesis are necessary (they certainly make things look clearer).

logic:
Output 1 if...
($i2$i3) is true;
~OR~ if BOTH of the following are true ($i1$i3).

typed up as so:
[expr (in2in3) || (in1in3)]

Max Patch
Copy patch and select New From Clipboard in Max.

As the above does not work in Gen~ expr, and even after trying a half dozen variations I'm still constantly getting error messages, I come to you for help!

Screen-Shot-2015-09-30-at-8.55.19-PM.png
png
Igneous Rock's icon

[added additional info to original post]

Graham Wakefield's icon

It's a typo (a missing &), which is confusing the GenExpr parser. Try:

[expr (in2in3) || (in1in3)]

Igneous Rock's icon

Ah, so simple! Thank you sincerely Graham. I am still learning the operators. You have helped me write my first proper logical expr expression, I'm thankful!

Graham Wakefield's icon

BTW if you prefer English, you can also write:

[expr (in2 < in3) and ((in1 < in2 or in1 > in3) or (in1 < in2 and in1 > in3))]