MathGroup Archive 1999

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

Search the Archive

Re: Working in Modules

  • To: mathgroup at
  • Subject: [mg15924] Re: Working in Modules
  • From: Jens-Peer Kuska <kuska at>
  • Date: Wed, 17 Feb 1999 23:33:57 -0500
  • Organization: Universitaet Leipzig
  • References: <7a2c0d$>
  • Sender: owner-wri-mathgroup at

Hi Don,

  you must assign a result to your replacement. 

                    {s=Table[Random[Integer],{n n}]},
will work.

The second works because the return value of a Module[] is
the last evaluated expression.

Hope that helps

Dr D McK Paul wrote:
> 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.
> 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}
>                     ]

  • Prev by Date: Re: tweaking log plots
  • Next by Date: Re: Working in Modules
  • Previous by thread: Re: Working in Modules
  • Next by thread: Re: Working in Modules