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

Source.ToCore: Let can be simplified #346

Open
amosr opened this issue Mar 4, 2016 · 1 comment
Open

Source.ToCore: Let can be simplified #346

amosr opened this issue Mar 4, 2016 · 1 comment

Comments

@amosr
Copy link
Contributor

amosr commented Mar 4, 2016

The conversion from Source to Core can be simplified a bit.
Lets are currently converted to a tuple of the input value and the let-bound expression. This was necessary in the original Core language because the streaming operations (Map, Filter) explicitly specified their input streams.
With the new Core, there are no explicit streams, and the body of folds and filter expressions can just refer to previously bound names. That means the let can be simplified to just the let-bound expression, and each reference just needs to refer to its name, rather than "first of input stream of blah".
I don't think this is resulting in worse end-result code right now, but it might be making flatten and melt a bit slower.

@amosr
Copy link
Contributor Author

amosr commented Mar 13, 2016

This is a bit more effort than I thought because the tupled version is still used by (latest x ~> fold f) (perhaps other things?).
In latest x ~> fold f, we store the whole tuple of everything that is in scope in the buffer, and then fold over it at the end.
We will need to modify latest to only store a tuple of what's actually used.
This is totally doable but I suspect there are lower-hanging fruit.

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

No branches or pull requests

1 participant