MathGroup Archive 2012

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

Search the Archive

Is it possible to flatten hash table?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124140] Is it possible to flatten hash table?
  • From: Szymon Roziewski <szymon.roziewski at gmail.com>
  • Date: Wed, 11 Jan 2012 04:18:24 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hello,
I would like to create a hash table for some data.

MakeHash[lon_, lat_, depth_] := Module[{Arr},
   Arr[lon <> " " <> lat] = depth;
   Arr
   ];

BathHashT =
  MakeHash[ToString[Rnd[#1, 6]], ToString[Rnd[#2, 6]], #3] & @@ # & /@
    Take[SeaBathCutEnd, 4];

Res = Flatten@BathHashT;

Res["-2.966667 -2.000000"]

As a result of Flatten I get  {Arr$2002701, Arr$2002702, Arr$2002703,
  Arr$2002704}["-2.966667 -2.000000"],

The function Rnd is to round a float number to 6 decimal digits.

So it seems to be 4 hash table. For each hash there is one table.
I thought that it could be flatten to one hash containing all data.
I could do  it in for loop but due to its poor perfmormance I wanted to
avoid that.


All best,
Szymon Roziewski


  • Prev by Date: select 1st column element based on criteria in 2nd column in mathematica
  • Next by Date: Re: Lack of 3D plot rotation handles ?
  • Previous by thread: Re: select 1st column element based on criteria in 2nd column in mathematica
  • Next by thread: Re: Is it possible to flatten hash table?