-
Notifications
You must be signed in to change notification settings - Fork 279
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
feat: inline comparison operators #1257
Conversation
± Registry diff
📊 PerformanceKeyNote that each bar component rounds up to the nearest 100ms, so each full bar is an overestimate by up to 400ms.
Data
|
Deploying with Cloudflare Pages
|
Codecov Report
@@ Coverage Diff @@
## main #1257 +/- ##
==========================================
- Coverage 63.44% 63.43% -0.02%
==========================================
Files 61 61
Lines 7176 7212 +36
Branches 1667 1680 +13
==========================================
+ Hits 4553 4575 +22
- Misses 2540 2553 +13
- Partials 83 84 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! This will actually improve the editing experience for Style dramatically for me (and I'm sure many others!). Just had a minor comment about parser tests below. Also I'll try and push some refactoring on the geometry domain
Refactored all |
BTW it'd be good to open issues about (1) chaining and (2) other logical operators (eg |
Co-authored-by: Wode "Nimo" Ni <wn2155@columbia.edu>
Looks super cool, thanks! Looking at the code now... quick question though, why does the |
We changed
|
Gotcha; but why does that change the colors? |
I guess the reason I'm asking is that I feel like the colors in the variation as of this PR don't look great; if that example does have to change, could you modify the variation to get nicer colors? |
I think the overall energy function changed, which means a different optimization ... But in reality now that I think about it, I shouldn't really touch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks Leo!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Description
Resolves #1168 .
We added the support for inline comparison operators. In particular,
a > b
is the syntax sugar forgreaterThan(a, b)
a == b
is the syntax sugar forequal(a, b)
a < b
is the syntax sugar forlessThan(a, b)
This applies to both constraints and objectives.
Implementation strategy and design decisions
We modified the parser so that constraints and objective declarations now look like
In other words, the of a constraint or objective now can either be a
Function Call
or anInline Comparison
.In the Style compiler where we handle constraints and objectives, we proceed as before when we encounter a
Function Call
. When we encounter anInline Comparison
, on the other hand, we handle it as if it is aFunction Call
, with the corresponding function name (lessThan
,greaterThan
, orequal
) and the two operands as parameters to the function.Tests have been added to the parser and compiler.
The docs site has been updated to include this syntactic sugar. Furthermore, we modified the
tree-venn
andtree-tree
example to utilize this syntactic sugar.Examples with steps to reproduce them
See examples
tree-venn
andtree-tree
with applications of this syntactic sugar.Checklist