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

counter example behavior unclear or buggy #54

Open
joeyh opened this issue Jan 24, 2020 · 1 comment
Open

counter example behavior unclear or buggy #54

joeyh opened this issue Jan 24, 2020 · 1 comment
Assignees
Labels
bug
Milestone

Comments

@joeyh
Copy link

@joeyh joeyh commented Jan 24, 2020

If the counter example is changed to run more steps than 270, it behaves in a way that was surprising to me. It resets once, at 256, but after counting back up from 0, it then continues past 256.

That might be what was intended, the comment that it "resets when it reaches 256" is perhaps just unclear. Since this was the second copilot program I tried, my impression was that it wasn't working right somehow.

Here's a version that behaved how I expected it to behave.

bytecounter :: Stream Int32
bytecounter = counter true reset where
reset = let n = counter true false
in n mod 256 == 0

(And I'm very impressed, BTW, that I was able to write the natural haskell code there, and it just worked in the copilot EDSL!)

@fdedden fdedden self-assigned this Feb 9, 2020
@fdedden fdedden added the bug label Feb 9, 2020
@fdedden
Copy link
Member

@fdedden fdedden commented Feb 9, 2020

Thanks for pointing out this bug! I can confirm that this indeed is a bug, and that it occurs in the C output as well.

We will be looking into this problem and keep you updated.

@fdedden fdedden added this to the (+1) milestone Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.