Given an array arr and an object v, I want a copy of arr without the elements equal to v.
I found these two solutions:
newarr = arr.dup newarr.delete(v) and
newarr = arr.reject {|a| a == v} Is there an easier way to do it?
I wonder whether Ruby already has something like:
newarr = arr.without(v)
delete.Array#deletecarefully and I ignored its return value. You are right.grep_vmay be useful but uses===instead of==so it's not the same thing.