Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Hash Table for self avoiding random walks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88458] Re: Hash Table for self avoiding random walks
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Tue, 6 May 2008 06:37:14 -0400 (EDT)
  • References: <fvmn1l$8jn$1@smc.vnet.net>

On May 5, 12:20 pm, "jwmerr... at gmail.com" <jwmerr... at gmail.com> wrote:
>
> h[{1,1}] = True;
> h[{1,2}] = True;
> h[{2,2}] = True;
>
> My primary complaint with this technique is that it seems to require
> giving your hash table a name with global scope.  What if I want to
> make 100 different walks?  Do I have to give them all separate names?
> I guess I could do something like h[10][1,1] = True;, but then I
> always have to keep track of which walk I'm working on.  I'd rather
> just be able to let them all be anonymous and stick them in a list.
>

Hi,

This is the approach that I'd recommend, too.  h does not need to have
global scope.  You can always put it into a Module:

Module[
  {h},
  ...
  ...
    h[{a,b}] = True
  ...
]

Szabolcs



  • Prev by Date: Re: Definite integral
  • Next by Date: Re: Finding the line that caused an error
  • Previous by thread: Re: Hash Table for self avoiding random walks
  • Next by thread: Re: Hash Table for self avoiding random walks