MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Insulating data from code

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66623] Re: Insulating data from code
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Wed, 24 May 2006 03:02:21 -0400 (EDT)
  • References: <e4ekai$9av$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Thanks, everybody. That was instructive.

For short lists, with Length@Flatten@B < 100 or so,
a version of J. Siehler's code is clearly fastest:

partitionedAz[A_, B_] /; Length@A >= Length@Flatten@B :=
              ReplacePart[B, A, Position[B,_,{-1},Heads->False],
                          Transpose@{Range@Length@Flatten@B}]

For longer lists, a two-stage version of my code is a little faster:

copyPartishun[A_, B_] /; Length@A >= Length@Flatten@B :=
              Map[A[[#]]&, Block[{i=0},Map[++i&,B,{-1}]] ,{-1}]


  • Prev by Date: Installation error
  • Next by Date: Re: Unit sphere triangulation
  • Previous by thread: Re: Insulating data from code
  • Next by thread: queuing network model