diff --git a/src/counts.jl b/src/counts.jl index 5ceec9a72da3ee..d292bf1bedfea3 100644 --- a/src/counts.jl +++ b/src/counts.jl @@ -159,7 +159,7 @@ proportions(x::IntegerArray, y::IntegerArray, k::Integer, wv::WeightVec) = propo ## auxiliary functions function _normalize_countmap{T}(cm::Dict{T}, s::Real) - r = (T=>Float64)[] + r = Dict{T,Float64}[] for (k, c) in cm r[k] = c / s end @@ -189,8 +189,8 @@ function addcounts!{T,W}(cm::Dict{T}, x::AbstractArray{T}, wv::WeightVec{W}) return cm end -countmap{T}(x::AbstractArray{T}) = addcounts!((T=>Int)[], x) -countmap{T,W}(x::AbstractArray{T}, wv::WeightVec{W}) = addcounts!((T=>W)[], x, wv) +countmap{T}(x::AbstractArray{T}) = addcounts!(Dict{T,Int}[], x) +countmap{T,W}(x::AbstractArray{T}, wv::WeightVec{W}) = addcounts!(Dict{T,W}[], x, wv) proportionmap(x::AbstractArray) = _normalize_countmap(countmap(x), length(x)) proportionmap(x::AbstractArray, wv::WeightVec) = _normalize_countmap(countmap(x, wv), sum(wv)) diff --git a/src/misc.jl b/src/misc.jl index 882c61d2037433..8c9a16252c915a 100644 --- a/src/misc.jl +++ b/src/misc.jl @@ -63,7 +63,7 @@ end # findat (get positions (within a) for elements in b) function indexmap{T}(a::AbstractArray{T}) - d = (T=>Int)[] + d = Dict{T,Int}[] for i = 1 : length(a) @inbounds k = a[i] if !haskey(d, k) @@ -74,7 +74,7 @@ function indexmap{T}(a::AbstractArray{T}) end function levelsmap{T}(a::AbstractArray{T}) - d = (T=>Int)[] + d = Dict{T,Int}[] index = 1 for i = 1 : length(a) @inbounds k = a[i] diff --git a/src/scalarstats.jl b/src/scalarstats.jl index 1ec0b92e813469..589aa2ec495d95 100644 --- a/src/scalarstats.jl +++ b/src/scalarstats.jl @@ -95,7 +95,7 @@ end # compute mode over arbitrary array function mode{T}(a::AbstractArray{T}) isempty(a) && error("mode: input array cannot be empty.") - cnts = (T=>Int)[] + cnts = Dict{T,Int}[] # first element mc = 1 mv = a[1] @@ -119,7 +119,7 @@ end function modes{T}(a::AbstractArray{T}) isempty(a) && error("modes: input array cannot be empty.") - cnts = (T=>Int)[] + cnts = Dict{T,Int}[] # first element mc = 1 cnts[a[1]] = 1