Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit 78327d1

Browse files
authored
Use the default Base implementation of map (#277)
This ensures that we get the correct element type, among other things. Fixes #276.
1 parent 513c046 commit 78327d1

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/datavector.jl

-10
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ function Base.deleteat!(dv::DataVector, inds)
100100
dv
101101
end
102102

103-
# TODO: should this be an AbstractDataVector, so it works with PDV's?
104-
function Base.map(f::Function, dv::DataVector)
105-
n = length(dv)
106-
res = DataArray(Any, n)
107-
for i in 1:n
108-
res[i] = f(dv[i])
109-
end
110-
return res
111-
end
112-
113103
function Base.push!{T,R}(pdv::PooledDataVector{T,R}, v::NAtype)
114104
push!(pdv.refs, zero(R))
115105
return v

test/dataarray.jl

+3
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,7 @@
9797
@test_throws BoundsError copy!(dest, 3, src, 1, 2)
9898
@test_throws BoundsError copy!(dest, 1, src, 2, 2)
9999
end
100+
101+
# Inferrability of map (#276)
102+
@test eltype(map(x -> x > 1, @data [1, 2])) == Bool
100103
end

0 commit comments

Comments
 (0)