Re: Mapping tag-value lists to a third
- To: mathgroup at smc.vnet.net
- Subject: [mg132456] Re: Mapping tag-value lists to a third
- From: carlos.felippa%colorado.edu at gtempaccount.com
- Date: Thu, 20 Mar 2014 05:27:45 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <lg64l7$gm1$1@smc.vnet.net>
Thanks to all who replied. For now I have implemented it as tagval=If [$VersionNumber>=5.1,Pick[val,tag,1],val*tag/. 0:>Sequence[]]; For big lists, Pick is slightly faster. Eg, for 10^7 length, on a MacPro: Pick 1.45 sec Sequence: 1.72 sec The reason for $VersionNumber is that Pick appeared in 5.1. Some users of my Mathematica codes are colleagues living overseas who run version 4 on old computers.