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


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

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

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to use Pick[]; Is this a bug?
Date 2012-08-15 07:33 +0000
Message-ID <k0fjd5$q87$1@smc.vnet.net> (permalink)
References <20120814082241.EB76F6854@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Appears to be a bug.

list = Range[5];

sel = {9, 0, 7, 0, 6};

Here are a few workarounds:

Pick[list, # != 0 & /@ sel]

{1, 3, 5}

Pick[list, sel, _?(# != 0 &)]

{1, 3, 5}


Bob Hanlon


On Tue, Aug 14, 2012 at 4:22 AM,  <benp84@gmail.com> wrote:
> 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]?
>

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


Thread

Re: How to use Pick[]; Is this a bug? Bob Hanlon <hanlonr357@gmail.com> - 2012-08-15 07:33 +0000

csiph-web