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

Calculator.make(fn) should work for all functions, not just 0-paramater ones #2694

Merged
merged 12 commits into from Dec 21, 2023

Conversation

OAGr
Copy link
Contributor

@OAGr OAGr commented Dec 12, 2023

Before, Calculator.make(fn), without passed-in columns, would only work if the function had zero params.

With this, it works more generally.

Most of the work was getting it to work with defaults / correct types, for FrTypes. This only helps for built-in functions, but could be useful for building on top of later on.

I kind of would like to wait for this, before doing testing:
#2739

* def-improvements-naming:
  Fixed tests
  Minor adjustment
  Show FnDocumentation with html
  Convert definitions to HTML
  Added documentation flag for namespace is optional
  Added named arguments for distributions
  Show documentation in view sidebar, when BuiltIn function is returned
  Show tuples with []
  Cleaned up mixture to use optional
  Adds names to many types
  In documentation, changed distribution -> dist
Copy link

changeset-bot bot commented Dec 12, 2023

🦋 Changeset detected

Latest commit: 89e330f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@quri/squiggle-lang Patch
@quri/squiggle-components Patch
@quri/prettier-plugin-squiggle Patch
vscode-squiggle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Dec 21, 2023 11:09pm
squiggle-components ✅ Ready (Inspect) Visit Preview Dec 21, 2023 11:09pm
squiggle-website ✅ Ready (Inspect) Visit Preview Dec 21, 2023 11:09pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Dec 21, 2023 11:09pm

@OAGr OAGr changed the base branch from main to def-improvements-naming December 12, 2023 20:38
Copy link
Contributor

sweep-ai bot commented Dec 12, 2023

Apply Sweep Rules to your PR?

  • Apply: All docstrings and comments should be up to date.
  • Apply: Ensure that all variables and functions have descriptive names.
  • Apply: Avoid using unnecessary separators or extra characters in code.
  • Apply: Use consistent indentation and spacing throughout the code.
  • Apply: Ensure that all code is properly formatted and follows the style guide.
  • Apply: Avoid using magic numbers or hard-coded values in the code.

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (779aa91) 71.54% compared to head (89e330f) 71.30%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2694      +/-   ##
==========================================
- Coverage   71.54%   71.30%   -0.24%     
==========================================
  Files         118      118              
  Lines        6474     6497      +23     
  Branches     1327     1339      +12     
==========================================
+ Hits         4632     4633       +1     
- Misses       1834     1856      +22     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@OAGr OAGr changed the title Calculator automake (draft) Calculator.make(fn) should work for all functions, not just 0-paramater ones Dec 18, 2023
@@ -153,6 +160,13 @@ export class SqLambdaValue extends SqAbstractValue<"Lambda", SqLambda> {
asJS() {
return this.value; // SqLambda is nicer than internal Lambda, so we use that
}

toCalculator(): SqCalculatorValue | undefined {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this for testing, but we're not using it otherwise right now. But it seems good to have.

Copy link
Collaborator

@berekuk berekuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see this feature implemented.

I'm hesitant about frTypes.ts and lambda.ts containing fields and methods that are needed for calculators, it seems like a violation of abstraction layers. I'd be more comfortable with frTypeToInput doing that job.

But I understand that it's a bit hard to do now because FRType doesn't always expose enough information yet. So it's not a problem if we merge this now and then refactor it later when FRType is converted to classes (which I plan to do soon).

keepBoxes?: boolean;
isOptional?: boolean;
tag?: string;
underlyingType?: FRType<any>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants