MathGroup Archive 1999

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

Search the Archive

Re: Working in Modules

  • To: mathgroup at
  • Subject: [mg21086] Re: Working in Modules
  • From: "Stephen P Luttrell" <luttrell at>
  • Date: Sun, 12 Dec 1999 23:51:54 -0500 (EST)
  • Organization: Defence Evaluation and Research Agency
  • References: <7a2c0d$>
  • Sender: owner-wri-mathgroup at

>This is my third attempt to post this question. No idea why it doesnt
>work. 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.
>                    {s=Table[Random[Integer],{n n}]},
>                    s/.{0->-1};
>                    Partition[s,n]
>                    ]
>                    {s=Table[Random[Integer],{n n}]},
>                    s/.{0->-1}
>                    ]

You need to change init to read as follows:

{s=Table[Random[Integer],{n n}],s1},

In your version where you do


the result of s/.{0->-1}; is not assigned back to s as you have assumed.

Stephen P Luttrell
Signal Processing and Imagery Department
DERA Malvern, St.Andrew's Road
Malvern, United Kingdom, WR14 3PS

+44 (0)1684 894046 (tel)
+44 (0)1684 894384 (fax)
luttrell at (email)

  • Prev by Date: SelectionEvaluate does not run in sequence
  • Next by Date: Cutting and pasting table to ascii file
  • Previous by thread: SelectionEvaluate does not run in sequence
  • Next by thread: Re: Working in Modules