Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: problem with Pick

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78220] Re: [mg78194] problem with Pick
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Tue, 26 Jun 2007 04:29:32 -0400 (EDT)
  • References: <acbec1a40706230431p4f1db9a9i4320680dda027396@mail.gmail.com>

On 6/25/07, Oyvind Tafjord <tafjord at wolfram.com> 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]]
Pick[{a,b,c},{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.

-- 
http://chris.chiasson.name/


  • 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