Re: Re: problem with Pick
- To: mathgroup at smc.vnet.net
- Subject: [mg78493] Re: [mg78409] Re: problem with Pick
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Tue, 3 Jul 2007 05:25:03 -0400 (EDT)
- References: <acbec1a40706230431p4f1db9a9i4320680dda027396@mail.gmail.com> <200707010731.DAA01680@smc.vnet.net> <86E8AE9E-5C16-4DE7-A78D-F7766C0D8E02@mimuw.edu.pl> <21764490.1183381902174.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
No matter how obvious all this may be to Andrzej and Oyvind... The fact remains, some of us have used Mathematica for eight years without seeing an example of [[]] until now. If documentation often or prominently mentioned it, we wouldn't be having this discussion. Nor have I seen an example in which [[]] is useful, rather than needlessly puzzling. (Unless I blinked and missed it.) I don't, by the way, insist on taking everything at face value. I test code to see what it actually does, EVERY TIME, because I'm just that cynical, both about the documentation and my own ability to interpret it. Most of the time I don't mind very much, either. It's always an adventure!! When the documentation is vague, ambiguous or contradictory and the habitual defenders rush in to claim it's not... and the rest of us are (apparently) just too dumb to read it properly... THAT is annoying. And not helpful. State in a positive and specific way that WRI meant i1,i2,... to include Sequence[] as a possibility, and here's what happens in that case, and we can all be thankful for the clarification. Tell us we should have already KNOWN that, and we get annoyed. I'm pretty sure that's a well-documented human reaction. Bobby On Mon, 02 Jul 2007 08:07:56 -0500, Chris Chiasson <chris at chiasson.name> wrote: > 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,â?¦]] for which sel >> [[i1,i2,â?¦]] 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â?¦]] for which sel[[i1â?¦]] > matches patt. > > > -- DrMajorBob at bigfoot.com
- References:
- Re: problem with Pick
- From: Chris Chiasson <chris.chiasson@gmail.com>
- Re: problem with Pick