-
Notifications
You must be signed in to change notification settings - Fork 0
Function definitions and variable annotations #36
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
Open
dorchard
wants to merge
9
commits into
main
Choose a base branch
from
defs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e549c2e
definitions and indentation
dorchard 9e574d3
annotations allowed on their own
dorchard a82baea
expand example
dorchard 73c5da1
Refactor argument binding in desugarDef function
dorchard cba096b
changelog
dorchard 5731d94
test cases
dorchard fada8d6
tidyup
dorchard 27e6eba
synthesis type of unit
dorchard 5f23ce7
empty tuple and typing
dorchard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # 0.3.0 - WIP | ||
| - `String` literals | ||
| - Exponentiation operation on floats (and their `Descriptor` analysis) | ||
| - Scientific notation accepted for floating-point literals | ||
| - `None` type (and its constructor `None`) built-in. | ||
| - `sqrt` function that is well-typed. | ||
| - Gradable booleans and conditional expressions | ||
| - `Species` and `Basis` descriptors | ||
| - Python-style `def` function blocks with typed arguments and `return` | ||
|
|
||
| # 0.2.0 - PROPL 2026 announcement (June 15, 2026) | ||
| - Pythonic syntax in types | ||
| - Typing now includes implicit types with type dependency (for resolving Float which has kind `{d : Descriptor} -> d -> Type` | ||
| - REPL `fortli` | ||
|
|
||
| # 0.1.0 - Initial version | ||
|
|
||
| - Straight line numerical code (with lambdas), Pythonic style. | ||
| - Type checking (with annotations). | ||
| Floats are graded abelian groups, graded by Descriptors which are generated by the free-abelian group over constructors names (which do not need defining and can be arbitrarily introduced, but must be guarded by Unit and Quantity constructors). | ||
| - Combinator for composing `Descriptor` values: `& : Descriptor -> Descriptor -> Descriptor` which behaves a bit like linear logic 'with' (additive conjunction). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,23 @@ | ||
| ## Small-orifice flow problem (Torricelli's law) | ||
| def small_orifice_flow(area, h): | ||
| """Area of the orifice""" | ||
| area : Float[Unit[m^2]] | ||
|
|
||
| # Area of the orifice | ||
| area : Float[Unit[m^2]] = 0.0 | ||
| """Distance from water surface to orifice""" | ||
| h : Float[Unit[m]] | ||
|
|
||
| # Acceleration of gravity | ||
| gravity : Float[Unit[m / s^2]] = 9.8065 | ||
| """Acceleration of gravity""" | ||
| gravity : Float[Unit[m / s^2]] = 9.8065 | ||
|
|
||
| # Distance from water surface to orifice | ||
| h : Float[Unit[m]] = 0.0 | ||
| """Ratio of actual flow to ideal flow""" | ||
| discharge_coefficient : Float[Unit[1]] = 0.61 | ||
|
|
||
| # Ratio of actual flow to ideal flow | ||
| discharge_coefficient : Float[Unit[1]] = 0.61 | ||
| q : Float[Unit[m ^ 3 / s]] = (discharge_coefficient | ||
| * area * sqrt((2.0 : Float[Unit[1]]) * gravity * h)) | ||
|
|
||
| q : Float[Unit[m ^ 3 / s]] = (discharge_coefficient | ||
| * area * sqrt((2.0 : Float[Unit[1]]) * gravity * h)) | ||
| return q | ||
|
|
||
| # Example | ||
| area : Float[Unit[m^2]] = 10.0 | ||
| h : Float[Unit[m]] = 5.0 | ||
| it = small_orifice_flow(area, h) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 60.406948 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.