Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] New ternary operator Within #265

Open
CorwinMacGregor opened this issue Jul 1, 2023 · 0 comments
Open

[Feature Request] New ternary operator Within #265

CorwinMacGregor opened this issue Jul 1, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation feature request New feature or request

Comments

@CorwinMacGregor
Copy link
Contributor

CorwinMacGregor commented Jul 1, 2023

I am constantly finding a need to check if a numeric value is between two bounds, and having to write and make function calls to do such checks. I believe a more natural language-form operator would not only allow the Easyscript to flow more naturally, but I suspect that coding the bounding checks within C# would be more efficient than having to parse the Easyscript function call and statements therein.

It should be noted that this is not intended for checking discrete integer values as that can be done with a mere
(A..B) contains X
But the Range operator only creates a list of discrete integer values within the resultant collection, and cannot address the (many) cases wherein X, A, and B are desired to be evaluated as floats.

(as BNF:)
::= ( 'within' | 'between' | '<>' ) ( '..' | 'and' ) [ ['inclusive'] | 'exclusive' ]

expression that checks if a numercal value mathematically falls within numerical range bounded by the other two arguments
Mind you, because of the natural language form of this operator inclines the ""speaker"" to use either '..' or 'and' to indicate separation between the lower and upper bounds, this ternary operator would have to have a higher precedence than either the bioperand numerical collection-creating Range '..' operator or the bioperand logical 'and' operator.

Alternatively, bounds could be separated by a '->' string, which should not conflict with precedence of any other known operators as of EasyCommands v2.0.0 (published Jan 14, 2023)

Regarding the Clusivity keyword, mathematicians often utilize them when referring to bounds to specify whether the bounds themselves are valid values. by default (that is, without an explicit Clusivity keyword), Clusivity should be 'inclusive'.
'inclusive': lower and upper bounds are valid values
'exclusive': lower and upper bounds are not valid values

examples, with functional equivalence:

X within A and B // return (( X >= A ) and ( X <=B ))

X between A and B exclusive // return (( X > A ) and ( X < B ))

@CorwinMacGregor CorwinMacGregor added documentation Improvements or additions to documentation feature request New feature or request labels Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant