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


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

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

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-08-15 07:33 +0000
Last post2012-08-15 07:33 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-08-15 07:33 +0000
SubjectRe: How to use Pick[]; Is this a bug?
Message-ID<k0fjd5$q87$1@smc.vnet.net>
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]?
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web