Re: problem with Pick
- To: mathgroup at smc.vnet.net
- Subject: [mg78232] Re: [mg78194] problem with Pick
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 26 Jun 2007 04:35:53 -0400 (EDT)
- References: <acbec1a40706230431p4f1db9a9i4320680dda027396@mail.gmail.com> <200706251106.HAA05048@smc.vnet.net>
On 25 Jun 2007, at 20:06, Chris Chiasson wrote: > Step to reproduce: > 1. Evaluate these two inputs with a fresh kernel: > Pick[{a,b},z[{},{1}],{__}] > In[78]:= Pick[{a, b}, {{}, {1}}, {__Integer}] > Out[78]= {b} > > Expected results: > {b} > {b} > > Actual results: > {b} > {a,b} > > Relevant Documentation: > Pick[list,sel,patt] picks out those list[[i1,i2,...]] for which > sel[[i1,i2,...]] matches patt. > > Relevant Evaluation: > In[3]:= MatchQ[{},{__}] > Out[3]= False > > In[4]:= {Internal`$CreationID,$Version} > Out[4]= {853857,6.0 for Microsoft Windows (32-bit) (April 27, 2007)} > > -- > http://chris.chiasson.name/ > But of course MatchQ[{{}, {1}}, {__}] True In other words, there is a Match at the top level in exactly the same way as here: Pick[{a, b}, {}, {___}] {a, b} You can avoid the top level match, by using, for example, Pick[{a, b}, {{}, {1}}, {__Integer}] {b} Andrzej Kozlowski
- References:
- problem with Pick
- From: "Chris Chiasson" <chris@chiasson.name>
- problem with Pick