Re: How to use Pick[]; Is this a bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg127696] Re: How to use Pick[]; Is this a bug?
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Wed, 15 Aug 2012 03:36:06 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20120814082241.EB76F6854@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 at 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]? >
- References:
- How to use Pick[]; Is this a bug?
- From: benp84@gmail.com
- How to use Pick[]; Is this a bug?