MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: problem with Pick

  • To: mathgroup at
  • Subject: [mg78220] Re: [mg78194] problem with Pick
  • From: "Chris Chiasson" <chris at>
  • Date: Tue, 26 Jun 2007 04:29:32 -0400 (EDT)
  • References: <>

On 6/25/07, Oyvind Tafjord <tafjord at> wrote:
> In this case, sel={{},{1}}. sel[[]] matches patt, and so list[[]] is picked out.
> This behavior, in which all of list gets picked, does produce a fair amount
> of confusion, unfortunately. It often shows up in connection with Except:
> In[1]:= Pick[{a, b, c}, {1, 2, 3}, Except[2]]
> Out[1]= {a, b, c}
> In[2]:= Pick[{a, b, c}, {1, 2, 3}, Except[2, _Integer]]
> Out[2]= {a, c}

Thank you for the reply.

You seem to be implying that the above behavior is intended, even
though it violates the documentation. I believe it is unintended, due
to the following output, which seems to indicate that the matches are
supposed to be checked on the first level:

In[1]:= Pick[{a,b,c},SparseArray@{1,2,3},Except[2]]

Out[1]= {a,c}

Out[2]= {a,b,c}

If I am wrong, then this SparseArray behavior is a bug, the
documentation is wrong, and I suggest that an optional level argument
be added to Pick.


  • Prev by Date: Re: problem with Pick
  • Next by Date: Re: PlotLegend and ListPlot
  • Previous by thread: Re: problem with Pick
  • Next by thread: Re: problem with Pick