MathGroup Archive 1999

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

Search the Archive

Re: Dont Understand

I'm confused too, but only about your name. Is it Don or Paul?

Your line s/.{0->-1} didn't change s, so the last command of init, which
is what a Module gives back, returned the Partition of the original s.
Init1 has as its last command s/.{0->-1}, so this is what you got.

Jurgen Karl Anton Tischer 

Don McKenzie Paul wrote:
> I'm not an expert in Mathematica and would appreciate comments on why
> init1 returns a list with all zeros replaced by -1, but init does not.
> Its probably very simple but its confused me.
> Don
> init[n_Integer]:=Module[
>                     {s=Table[Random[Integer],{n n}]},
>                     s/.{0->-1};
>                     Partition[s,n]
>                     ]
> init1[n_Integer]:=Module[
>                     {s=Table[Random[Integer],{n n}]},
>                     s/.{0->-1}
>                     ]
> --
> Prof. Don McKenzie Paul               tel.  (1203) 523603 Department of
> Physics                 fax.  (1203) 692016 University of Warwick
> email  phrje at COVENTRY CV4 7AL
> UK

  • Prev by Date: Re: Mathematica vs. Executable code
  • Next by Date: Re: Wigner matrices Dpq(a) implementation
  • Previous by thread: Dont Understand
  • Next by thread: RE: Dont Understand