Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11446

Re: How to use Pick[]; Is this a bug?

From awnl <awnl@gmx-topmail.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to use Pick[]; Is this a bug?
Date 2012-08-22 07:54 +0000
Message-ID <k12385$eo$1@smc.vnet.net> (permalink)
References <k0d1sm$lvc$1@smc.vnet.net> <k0fje4$q8n$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Hi,

>> In[1]:=  Pick[{1, 2, 3, 4, 5}, {9, 0, 7, 0, 6}, Except[0]]
>> Out[1]:= {1, 2, 3, 4, 5}
>>
>> Shouldn't this return {1, 3, 5}, since these are the corresponding elements that match Except[0]?
>>
>
>    the whole list {9, 0, 7, 0, 6} is unequal to the Integer 0.

that's an explanation of what goes wrong, but it still looks very much 
like a bug to me: Nothing in the documentation gives a hint that the 
second argument as a whole would ever be tried to match the third 
argument -- and it wouldn't seem to make any sense to do so for the 
given functionality...

> What you want is:
>
> Pick[{1, 2, 3, 4, 5}, {9, 0, 7, 0, 6}, Except[0, _Integer]]

that's of course a very useful workaround

cheers,

albert

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to use Pick[]; Is this a bug? benp84@gmail.com - 2012-08-14 08:22 +0000
  Re: How to use Pick[]; Is this a bug? Peter Pein <petsie@dordos.net> - 2012-08-15 07:34 +0000
    Re: How to use Pick[]; Is this a bug? awnl <awnl@gmx-topmail.de> - 2012-08-22 07:54 +0000

csiph-web