Created
October 23, 2016 15:16
-
-
Save nalimilan/32c86f9ca809a08ecbdec3ecbd3a92f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sumequals{T}(A::AbstractArray{Int}, d::Dict{T, Int}, v::T) | |
n = 0 | |
@inbounds for x in A | |
n += get(d, v, 0) == x | |
end | |
n | |
end | |
A = repeat(1:5, outer=1000) | |
d = Dict("A"=>1, "B"=>2, "C"=>3) | |
sumequals(A, d, "C") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment