Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

RE: odd behaviour in rule delayed

  • To: mathgroup at
  • Subject: [mg21531] RE: [mg21499] odd behaviour in rule delayed
  • From: Francisco Gutierrez <rpena at>
  • Date: Fri, 14 Jan 2000 02:43:48 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

Thanks to Bob Hanlon, Henry Foley, David Reiss, Allan Heiss, Roland
Franzius,Hartmut Wolf, Tom Burton,Daniel Lichabau, Jahaness Lusteck and
other who helped me with my problem with ruledelayed.

In my message I input a typo (k and kk) in the counter that introduced some
noise.  But all the messages coincided in showing the true difficulty: in
the abscence of parenthesis,m4.0 interpreted the operation as a division,
not as a replacement rule.

You were all very helpul;thanks again.

Francisco Gutierrez

----- Original Message -----
From: <BobHanlon at>
To: mathgroup at
Subject: [mg21531] Re: [mg21499] odd behaviour in rule delayed

> list = {1, 0, 1, 0, 0, 1};
> k = 1;
> newlist = list /. {1 :> k++}
> {1, 0, 2, 0, 0, 3}
> Bob Hanlon
> In a message dated 1/12/2000 10:00:20 AM, rpena at writes:
> >I have M 4.0, window 95.
> >I have a list of 0's and 1's, and I want the one's to perform a
> >numeration. For example, transform {1,0,1,0,0,1} into {1,0,2,0,0,3}.
> >
> >The easiest (and most elegant, I think) way to do it is with a counter
> >and
> >rule delayed:
> >list={1,0,1,0,0,1}
> >kk=0; newlist={1,0,1,0,0,1} /.1:>++k
> >
> >However, the answer I get from this operation is completely
> >odd:{10.,0,10.,0,0,10.}:>++k.  I closed my session and re-started my
> >computer, but I keep getting the same stuff.  I don't understand what is
> >happening. By the way, this problem didn't appear in M3.0.
> >

  • Prev by Date: Re: "mma" becomes "Mathematica"
  • Next by Date: Re: Limit problem from analysis
  • Previous by thread: Re: odd behaviour in rule delayed
  • Next by thread: ReadList of Complex Numbers