-
-
Notifications
You must be signed in to change notification settings - Fork 104
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: add new remake(::AbstractSciMLFunction)
, fix some remake
bugs.
#891
feat: add new remake(::AbstractSciMLFunction)
, fix some remake
bugs.
#891
Conversation
0be8edc
to
6c15292
Compare
dd16264
to
d455a5a
Compare
Formatting issues are on master, will make a separate PR to fix them to avoid confusing the intent of this one. |
""" | ||
$(TYPEDSIGNATURES) | ||
|
||
A utility function which merges two `NamedTuple`s `a` and `b`, assuming that the | ||
keys of `a` are a subset of those of `b`. Values in `b` take priority over those | ||
in `a`, except if they are `nothing`. Keys not present in `a` are assumed to have | ||
a value of `nothing`. | ||
""" | ||
function _similar_namedtuple_merge_ignore_nothing(a::NamedTuple, b::NamedTuple) | ||
ks = fieldnames(typeof(b)) | ||
return NamedTuple{ks}(ntuple(Val(length(ks))) do i | ||
something(get(b, ks[i], nothing), get(a, ks[i], nothing), Some(nothing)) | ||
end) | ||
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.
isn't this just (;a..., b...)
?
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.
No, because nothing
values in b
will override values in a
. This function makes it so that if a key has the value nothing
in b
, it uses the value from a
.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.