I wanted to use the Pick
function with a condition. But there seems to be an issue here. Take a look at this:
selection = {0,1.2,3,0.,5};
Pick[{1,2,3,4,5},selection,elem_ /; elem =!= 0]
In Mathematica 8 it will give {1,2,3,4,5}
instead of {2,3,4,5}
. Please note, that the Pick
function works nicely with
Pick[{1,2,3,4,5},selection,elem_ /; elem === 0]
Giving {1}
as a result. Is this a bug or am I missing something?
Pick
confusion and a special case ofPick
withSparseArray
. $\endgroup$