Re: Re: problem with Pick
- To: mathgroup at smc.vnet.net
- Subject: [mg78479] Re: [mg78409] Re: problem with Pick
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Tue, 3 Jul 2007 05:17:47 -0400 (EDT)
- References: <acbec1a40706230431p4f1db9a9i4320680dda027396@mail.gmail.com>
On 7/2/07, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote: <snip/> > Actually, there is nothing at all unusual about barbers shaving > themselves. I am sure lots of barbers do it. Russell's illustration > (of a variant of his paradox) was about a barber who "shaved everyone > in town who did not shave himself". It would take more than all the > resourcefulness of Figoro, the barber of Seville, to relate this to > this description of the behaviour of Pick, also taken from the > documentation: > > Pick[list,sel,patt] picks out those list[[i1,i2,=85]] for which sel > [[i1,i2,=85]] matches patt. > > Now, this is a pretty straight forward statement which describes > precisely the behaviour of Pick - but I am afraid it's not likely to > generate any more feats of philosophical depth and wit. > > I do agree that the statement quoted by Bobby can mislead those who > insist on taking everything at face value but it was only meant as a > "first order approximation" and it is enough to dig a little deeper > into the documentation to see that the behaviour of Pick that Chris > objected to is in fact clearly documented. > > Andrzej Kozlowski I disagree: The documentation fails to properly indicate on which level it is starting the comparison (and possibly whether the matching is depth-first or top-first). Compare MemberQ to the behavior of Pick mentioned in my first post of the thread: In[1]:= MemberQ[z[{},{1}],{__}] MemberQ[z[{},{}],{__}] MemberQ[{{},{}},{__}] Out[1]= True Out[2]= False Out[3]= False The behavior of MemberQ (and Cases, etc) is much more predictable because its documentation actually tells you on which level it starts comparing things. Attempting to describe the behavior of a multi-level pattern matching function solely in terms of evaluation of Part is not very precise. Finally, if they wanted me to not be surprised, they should have said: Pick[list,sel,patt] picks out those list[[i1=85]] for which sel[[i1=85]] matches patt. -- http://chris.chiasson.name/