-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat: Adds Dynamic.sort & improves output of failing dynamic tests #1411
Conversation
of expected vs actual instead of displaying "true" : "true"
|
@TimDeve Yeah there has been some discussions about that, but since the idea is to replace the dynamic map with a faster, built-in one I think we decided to just wait for that instead. |
Oh is that the idea? I didn’t know! Bummer, I was hoping we’d move more code out of Haskell and into Carp rather than the other way around. |
I wasn't quite sure if having this in "userspace" was the goal or a shortcut. If we want to keep in Carp I'm wondering if we could "tag" the list with a symbol to be able to tell the difference between a simple list and a map. |
In my mind, we had more or less agreed on this, but maybe I'm misremembering. In general I agree that not putting stuff in Haskell is the right choice, but for the dictionary I think just doing the fastest thing possible is correct. |
We tried this in #1177 but it was shot down for now. |
Maybe we can revisit this now, if you're up for it? I still think it's a good idea. Having more specialized data structures available in dynamics is a win imo. As I said in that PR thread I think the only thing I'd want is to make sure it's clear in the code when a type is dynamic vs. when it's static. Also I think it's orthogonal to the dictionary issue. If Haskell based dicts are significantly faster it makes sense to me to use them, but I think dynamic types would still be a useful feature aside from that. |
Yeah, agreed. |
It’s not orthogonal in that it allows custom stringification for dynamic types, which is what prompted the conversation. |
I meant more to have a marker at the front of the list rather than proper dynamic types so ('dynamic-map-marker () () () () () () () () () () () () () () () ((100000000000000000 2))) compared to the current: (() () () () () () () () () () () () () () () ((100000000000000000 2))) Edit: |
Replaces it with sort + equal. While this is less "correct", having complex untested functions within test files is undesirable. This implementation is "good enough" for lists of integers.
It's ready to merge if people are okay with the changes. |
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.
Great!
This adds Dynamic.sort function based on the quicksort described here.
It also contains a refactor of the dynamic test handles to properly display a diff of the expected Vs actual value rather than displaying "true" : "false".
Test display examples:
old:
new: