-
Notifications
You must be signed in to change notification settings - Fork 64
Implement Base.:(==) for thunks
#367
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,12 @@ | ||
| @testset "Thunk" begin | ||
| @test @thunk(3) isa Thunk | ||
|
|
||
| @testset "==" begin | ||
| @test @thunk(3.2) == InplaceableThunk(@thunk(3.2), x -> x + 3.2) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to have this? Or should we separate between Thunks and InplaceableThnks?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thus by transitivity thye must be equal to each other |
||
| @test @thunk(3.2) == 3.2 | ||
| @test 3.2 == InplaceableThunk(@thunk(3.2), x -> x + 3.2) | ||
| end | ||
|
|
||
| @testset "show" begin | ||
| rep = repr(Thunk(rand)) | ||
| @test occursin(r"Thunk\(.*rand.*\)", rep) | ||
|
|
||
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.
There are some special case we might be able to optimize the positive cases like
a===bto avoid unthunking.idk if worth it though