Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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