InitialValues.jl
InitialValues.jl copied to clipboard
suppport union
just want to make ThreadsX.reduce(union, xs)
work
Codecov Report
Merging #60 (94a1b6c) into master (cd91162) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #60 +/- ##
=======================================
Coverage 93.33% 93.33%
=======================================
Files 2 2
Lines 60 60
=======================================
Hits 56 56
Misses 4 4
Flag | Coverage Δ | |
---|---|---|
unittests | 93.33% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
src/InitialValues.jl | 90.90% <ø> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update cd91162...94a1b6c. Read the comment docs.
Thanks for the PR!
I thought it made sense, and I was about to merge it, and then realized that there was a bit of subtle issue with Number
s:
julia> union(1)
1-element Vector{Int64}:
1
Ideally, isequal(union(INIT, x), union(x))
holds, but it wouldn't be the case here. It might still make sense but let me ponder about this a bit.
FYI, it'd be a bit more efficient if you do
using ThreadsX
using Transducers: OnInit
ThreadsX.reduce(union!, 1:10; init = OnInit(Set{Int}))
if the element type is known or
using ThreadsX
using BangBang
ThreadsX.reduce(union!!, 1:10)
if the element type is unknown. You can also do ThreadsX.Set(Iterators.flatten(xs))
if the sets you are trying to union
over have "fast enough" iterate
.
ah thanks! I didn't know there is OnInit
!