MathGroup Archive 2007

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

Search the Archive

Re: Re: problem with Pick

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78495] Re: [mg78409] Re: problem with Pick
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Tue, 3 Jul 2007 05:26:05 -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> <op.tuus22zfqu6oor@monster.ma.dl.cox.net> <23903468.1183413753892.JavaMail.root@m35> <op.tuuz64tbqu6oor@monster.ma.dl.cox.net> <9830179.1183421323421.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

> Pick[{{{a}}, {b}, c}, l, _]
>
> {{{a}}, {b}, c}
>
> and
>
> Pick[{{{a}}, {b}, c}, True]
> { {{a}} , {b}, c}
>
> are perfectly understandable if you think in terms of pattern matching

Yeah, yeah, we get it now. AFTER wasting too much time on it.

We're all reasonably smart, here... if a lot of us had the wrong  
impression of both Pick and Part, the documentation bears at least a  
LITTLE responsibility for that.

Regardless of how pattern matching works, it remains that documentation 
doesn't tell us (1) at which level matching begins or (2) what the result  
(if any) of expr[[]] would be.

Those examples also make me wonder what Help "means" when it says:

"The selector list has to have the same length and structure as the data:"

> The problem is that pattern matching is not easy to explain in one or 

> two lines of documentation.

ONE line is all it takes to let us know Part's second argument can be  
nothing at all, and what the result would be. It's no harder than the line  
that says

"Part 0 of an expression is its head."

If Part had been implemented so that expr[[]] == Head[expr][] -- and I see  
no reason why it couldn't or shouldn't have been -- we'd have a different  
result from Pick, and I think you'd be arguing for its transparent  
inevitability.

Bobby

On Mon, 02 Jul 2007 19:04:39 -0500, Andrzej Kozlowski <akoz at mimuw.edu.pl>  
wrote:

> It seems to me that the whole discussion of parts, empty sets etc. is 
> really beside the point, although I admit that the vagueness of the  

> documentation on this point can give rise to this representation. For 

> example both
>
> Pick[{{{a}}, {b}, c}, l, _]
>
> {{{a}}, {b}, c}
>
> and
>
> Pick[{{{a}}, {b}, c}, True]
> { {{a}} , {b}, c}
>
>
> aare perfectly understandable if you think in terms of pattern matching  
> but require (quite unnecesasary) mental acrobatics to explain in terms 
> of the properties of the empty set, NOTHING, EVERYTHING or barbers. The  
> problem is that pattern matching is not easy to explain in one or two 
> lines of documentation.
>
> Andrzej Kozlowski
>
>
>
>
> On 3 Jul 2007, at 07:46, DrMajorBob wrote:
>
>> If I were collecting indices on some criterion and didn't get any, I'd  
>> want the result to be some logical equivalent of NOTHING, not  
>> EVERYTHING.
>>
>> expr[[]] = Head[expr][], for instance.
>>
>> But Mathematica doesn't do it that way so, as I've said before, we'll 
>> just have to adjust our expectations.
>>
>> Bobby
>>
>> On Mon, 02 Jul 2007 16:58:11 -0500, Chris Chiasson  
>> <chris at chiasson.name> wrote:
>>
>>> On 7/2/07, DrMajorBob <drmajorbob at bigfoot.com> wrote:
>>> <snip/>
>>>> Nor have I seen an example in which [[]] is useful, rather than  
>>>> needlessly
>>>> puzzling.
>>>>
>>>> (Unless I blinked and missed it.)
>>>
>>> It could be useful if one is generating the arguments to Part via a
>>> program. If there are no sub-parts needed, then Sequence[] should be
>>> sent as the second argument.
>>>
>>
>>
>>
>> --DrMajorBob at bigfoot.com
>
>



-- 

DrMajorBob at bigfoot.com


  • Prev by Date: Re: Re: Rotable Graphics and ViewPoint
  • Next by Date: Re: AW: position of matrix elements for intervals
  • Previous by thread: Re: Re: problem with Pick
  • Next by thread: Re: Re: problem with Pick