Skip to content

Commit

Permalink
add svec comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed May 7, 2015
1 parent 322f072 commit 5e41085
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ next(v::SimpleVector,i) = (v[i],i+1)
done(v::SimpleVector,i) = (i > v.length)
isempty(v::SimpleVector) = (v.length == 0)

function ==(v1::SimpleVector, v2::SimpleVector)
length(v1)==length(v2) || return false
for i = 1:length(v1)
v1[i] == v2[i] || return false
end
return true
end

map(f, v::SimpleVector) = Any[ f(v[i]) for i = 1:length(v) ]

getindex(v::SimpleVector, I::AbstractArray) = svec(Any[ v[i] for i in I ]...)
Expand Down

0 comments on commit 5e41085

Please sign in to comment.