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

Symbolic Compositional Resource Sharers #136

Closed
wants to merge 24 commits into from
Closed

Symbolic Compositional Resource Sharers #136

wants to merge 24 commits into from

Conversation

olynch
Copy link
Member

@olynch olynch commented Feb 9, 2024

This PR is for the draft of symbolic, compositional resource sharers, and also includes a new namespacing mechanism via Tries.

@jpfairbanks
Copy link
Member

I like the approach here to supporting namespaced variables, but I really think that people will get confused by the name Package not referring to a package of code. Can we use Namespace or Names instead of package?

@epatters
Copy link
Member

epatters commented Feb 9, 2024

Agreed on the name. I think it's too confusing.

@olynch
Copy link
Member Author

olynch commented Feb 9, 2024

I'm happy not calling it Package, but I don't like namespace. The point is that Package doesn't just include the names; it also includes an assignment of those names to values. A package has a namespace, which is the set of valid index paths. We could just call it a trie, which is what it is.

Copy link

codecov bot commented Feb 9, 2024

Codecov Report

Attention: Patch coverage is 86.36364% with 84 lines in your changes missing coverage. Please review.

Project coverage is 92.14%. Comparing base (bd3df8e) to head (41a9fc3).

Files Patch % Lines
src/stdlib/models/twosorted.jl 0.00% 27 Missing ⚠️
src/syntax/gats/closures.jl 73.77% 16 Missing ⚠️
src/syntax/gats/ast.jl 82.08% 12 Missing ⚠️
src/util/Dtrys.jl 95.15% 11 Missing ⚠️
src/nonstdlib/dynamics/ResourceSharers.jl 94.79% 9 Missing ⚠️
src/syntax/gats/algorithms.jl 61.11% 7 Missing ⚠️
src/syntax/gats/exprinterop.jl 88.23% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #136      +/-   ##
==========================================
- Coverage   93.85%   92.14%   -1.71%     
==========================================
  Files          38       42       +4     
  Lines        2229     2802     +573     
==========================================
+ Hits         2092     2582     +490     
- Misses        137      220      +83     

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

@olynch olynch changed the title Packages Symbolic Compositional Resource Sharers Feb 15, 2024
olynch added 2 commits July 1, 2024 17:02
named tuple types

sketch of road to dynamical systems

updated roadmap

resource sharers sketch

ENH: basic @algebraic macro

In order to make symbolic ODEs, we first have to have symbolic functions.

This commit is the first step towards that, introducing the `@algebraic` macro
which makes a DSL for introducing symbolic functions.

These hook into the Julia scope system, so they can conveniently call
other symbolic functions which happen to be in scope.

BUG: return the closure not the method from @algebraic

This is a very small change to the previous commit.

We still need to write some extensive tests for `@algebraic`

rhizome composition initiated

ocompose is written, but we have to make an easy way of
writing down rhizomes before we can test it in any serious way.

Along the way, several useful utilities to work with Tries have been
added.

rhizome macro

oapply for resource sharers works on the happy path!

added docs for resource sharers

started nonemptytrie refactor

more principled approach to empty tries

We want a trie to be uniquely determined by the set of valid TrieVars
that it supports. If we allow there to be empty branches, i.e. corresponding
to the named tuple `(a::(b::()))`, then this has no valid paths in it,
but is different from `()`. To solve this, we make two types: `Trie`
and `NonEmptyTrie`. The recursive case is `NonEmptyTrie`: a `Trie`
is just a wrapper around `Union{Nothing, NonEmptyTrie{A}}`.

This was inspired by the way yuujinchou works.

Also new in this commit is the use of MLStyle active patterns to
make pattern matching on tries cleaner. This is a huge upgrade to the
previous way we were doing things, and I think that we should use more
active patterns in the future throughout GATlab, for pattern matching
on unityped data. See the active patterns Leaf, Node, Empty, Root, Nested
in src/syntax/Tries.jl for more information.

fixup: make more things work for the trie refactor

fixup: add tests and docs for Trie methods

fix: wrapped dot accessor in quotenode

The code `a.b` is represented as a Julia expression by
`Expr(:(.), :a, QuoteNode(:b))`, not `Expr(:(.), :a, :b)`. The former
will produce a undefined variable error because it tries to look up `b`.

fix: move tries to util and include tries tests

fixup: added resource sharers to nonstdlib tests

test: addressed missing coverage for Tries.jl

fix: can't use keys as a variable name at the top level

fix: added orderedcollections to test env

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

Successfully merging this pull request may close these issues.

4 participants