-
Notifications
You must be signed in to change notification settings - Fork 64
fix iteration of thunks #370
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
Conversation
| next isa Nothing && return nothing | ||
| element, new_state = next | ||
| return element, (val, new_state) | ||
| end |
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.
we may want to rename val to obj or underlying_object or something.
so it is clear that it is the object actually being iterated rather than being a value from the object being iterated
simeonschaub
left a comment
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.
LGTM!
src/differentials/thunks.jl
Outdated
| @inline function Base.iterate(::AbstractThunk, (val, state)) | ||
| element, new_state = iterate(val, state) | ||
| next = iterate(val, state) | ||
| next isa Nothing && return nothing |
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.
Doesn't really matter, but this is generally more idiomatic:
| next isa Nothing && return nothing | |
| next === nothing && return nothing |
Codecov Report
@@ Coverage Diff @@
## master #370 +/- ##
==========================================
+ Coverage 87.42% 88.86% +1.44%
==========================================
Files 14 14
Lines 485 485
==========================================
+ Hits 424 431 +7
+ Misses 61 54 -7
Continue to review full report at Codecov.
|
Fixes #369