Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*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 1999

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

Search the Archive

Working in Modules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15860] Working in Modules
  • From: phrje at mimosa.csv.warwick.ac.uk (Dr D McK Paul)
  • Date: Fri, 12 Feb 1999 18:40:21 -0500 (EST)
  • Organization: University of Warwick, UK
  • Sender: owner-wri-mathgroup at wolfram.com

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}
                    ]


--

Prof. Don McKenzie Paul               tel.  (1203) 523603 Department of
Physics                 fax.  (1203) 692016 University of Warwick      
email  phrje at csv.warwick.ac.uk COVENTRY CV4 7AL
UK
-- 
****************************************************** Professor Don
McKenzie Paul
Department of Physics
University of Warwick


  • Prev by Date: Re: I am looking for code to READ DXF files in Mathematica
  • Next by Date: Re: log plots
  • Previous by thread: Re: Re: Re: Re: Bug?
  • Next by thread: Re: Working in Modules