A previous discussion of this issue
(Is there a bug in Pick?)
accepted that matching at level 0 is not a bug in Pick
. Was that correct? I am not yet persuaded.
Here is the documentation (http://reference.wolfram.com/language/ref/Pick.html):
"Pick[list,sel,patt]
picks out those elements of list
for which the corresponding element of sel
matches patt
."
This clearly speaks of corresponding elements. It seems to me that either there is a documentation bug or there is an implementation bug. Why am I wrong? Furthermore, the documentation gives the obvious statement of intent, so I suspect an implementation bug.
Here is (yet) another example that illustrates how bizarrely unexpected is the current behavior:
x = Range[20]
Pick[x, x/2, _Integer] (* works as expected *)
Pick[x, x/2, Except[_Integer]] (* does not work as expected *)
I find it almost impossible to believe that Pick
was intended to cause this simple use of Except
to fail by matching the entire list x/2
rather than, as the documentation states, checking for a match in the corresponding element.
Note that I am not asking how to get the intended match; I realize that Except[_Integer|_List]
will accomplish that in this case. Also, I am using Mma 9.