Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Q: efficient list operation wanted

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13973] Q: efficient list operation wanted
  • From: Klaus Duellmann <k.duellmann at uni-mannheim.deXXX>
  • Date: Fri, 11 Sep 1998 15:07:01 -0400
  • Organization: Rechenzentrum Uni Mannheim
  • Sender: owner-wri-mathgroup at wolfram.com

I am looking for an efficient solution of the following problem:

Given two lists L1 = {1,2,3,4,5,3,7,2,3,9} and L2 = {a, b, c}

I want to replace all numbers 3 in L1 by the elements of L2
successively,
that is the first 3 by a, the second 3 by b and the third 3 by c. That
is I want to get the following modified L1-list: {1,2,a,4,5,b,7,2,c,9}.

Replace[] unfortunately replaces elements with a single element only. Is
there a chance to avoid hideous Do-Loops?

Any hints are appreciated!

PS. Remove XXX from my e-mail-address

K. Duellmann


  • Prev by Date: Figures displayed on video but not printed
  • Next by Date: Re: Figures displayed on video but not printed
  • Previous by thread: 2D-Graphics with 2 different axis
  • Next by thread: Re: Q: efficient list operation wanted