Skip to content

Commit

Permalink
Permit non-number types in Accumulator (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov authored Jul 11, 2023
1 parent e62f469 commit e3fa7b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/accumulator.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#A counter type

"""
Accumulator{T, V<:Number}
Accumulator{T, V}
A accumulator is a data structure that maintains an accumulated total for each key.
The particular case where those totals are integers is a counter.
"""
struct Accumulator{T, V <: Number} <: AbstractDict{T, V}
struct Accumulator{T, V} <: AbstractDict{T, V}
map::Dict{T, V}
end

## constructors

Accumulator{T, V}() where {T, V <: Number} = Accumulator{T, V}(Dict{T, V}())
Accumulator{T, V}() where {T, V} = Accumulator{T, V}(Dict{T, V}())
Accumulator(map::AbstractDict) = Accumulator(Dict(map))
Accumulator(ps::Pair...) = Accumulator(Dict(ps))

Expand Down

5 comments on commit e3fa7b6

@Krastanov
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oxinabox , may we run Julia registrator on this?

@Krastanov
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe run it after potentially merging this #861

@oxinabox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current master branch of DataStructures.jl is frozen pending #479
This could be backported to release-0.18 if required

@Krastanov
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, noted! Am I correct in assuming that #479 would not be done at least for another few weeks (or months)? If that is the case, I would like to prepare a backport pull request. I will wait for the review of #861 first though.

@oxinabox
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least for another few weeks (or months)?

years probably, unless we pick up some more maintainers who have interest in working on it.

Please sign in to comment.