-
Notifications
You must be signed in to change notification settings - Fork 70
Allow appending and then dropping the same number of elements from Stream #608
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
strikef
wants to merge
5
commits into
Copilot-Language:master
Choose a base branch
from
strikef:fix/drop-as-appended
base: master
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 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7d0ed3c
throw `DropIndexOverflow` only when drop length exceeds app length
strikef 9e39318
simplify `drop k (app k s)` to avoid erroneous C codegen when |drop| …
strikef 67482fc
Move fix to `Temporal` and add explanatory comments
strikef b1ad228
Remove redundant diff
strikef c6e7a99
Fix indent and formatting
strikef 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
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
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.
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.
Can you include a comment here saying why we need a special case for
k == length a
? It wasn't obvious to me until I read the PR description.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.
Relatedly, I wonder if
Copilot.Language.Reify
if the right place to implement this transformation. Most of the simplifications that are performed overDrop
streams are implemented in thedrop
function itself:copilot/copilot-language/src/Copilot/Language/Operators/Temporal.hs
Lines 35 to 39 in e042933
Perhaps we should implement this transformation as an additional case of
drop
?Uh oh!
There was an error while loading. Please reload this page.
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.
Not part of this issue, but that might be a good place to also do something like:
Uh oh!
There was an error while loading. Please reload this page.
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.
I agree that
Reify
module isn't the best place to implement this fix. TheTemporal
module you recommended looks better to me as well.My initial intent of this change was getting correct C code (which is why I placed this fix at
Reify
module), and at that time simplification was just a 'nice' side-effect. But now that you mentioned, I don't see any reason to not treat it as simplification.I'll move my fix to
Temporal
module and add explanatory comment as well.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.
Fixed as suggested