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


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

Re: Mapping tag-value lists to a third

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!news-xxxfer.readnews.com!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From carlos.felippa%colorado.edu@gtempaccount.com
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Mapping tag-value lists to a third
Date Thu, 20 Mar 2014 09:28:06 +0000 (UTC)
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <lgecb6$7om$1@smc.vnet.net> (permalink)
References <lg64l7$gm1$1@smc.vnet.net>
Lines 14
Organization Time-Warner Telecom
NNTP-Posting-Date 20 Mar 2014 09:33:49 GMT
NNTP-Posting-Host 2846b073.news.twtelecom.net
X-Trace DXC=1<jI_BHWU5O:^L5n5Q6mGEC_A=>8kQj6M;[h;PUXBgbDHnHVmV3ecQDEFiONJ7[GoFW[k`Uio4cCL
X-Complaints-To abuse@twtelecom.net
X-Received-Bytes 1264
X-Received-Body-CRC 1740817419
Xref csiph.com comp.soft-sys.math.mathematica:16676

Show key headers only | View raw



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.  

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar


Thread

Mapping tag-value lists to a third carlos.felippa%colorado.edu@gtempaccount.com - 2014-03-17 06:27 +0000
  Re: Mapping tag-value lists to a third carlos.felippa%colorado.edu@gtempaccount.com - 2014-03-20 09:28 +0000

csiph-web