[erlang-questions] 2D Map Arrays

Jeff Crane <>
Thu Sep 7 21:54:38 CEST 2006


I am trying to implement a 2d map in erlang where
dynamic elements will be traversing it via reference.
I have no other way to get the "locations" into memory
other than using a large array, explicitly for
reading. 

The bottom "terrain" layer is what the static array
represents. Putting this in memory consists of reading
from a text file in the example format:
{ % map tuple start
  {  % row start
    {ID,{a1,a2}}, % column
    ...
  }, % row end
  ...
} % map tuple end

Question: read it into memory as a large tuple or
list?

I have heard of a "binary" format in erlang that is
used for this kind of read-without-copy on large
amounts of data. I assume that I should read out a map
export then convert it to binary, then read it
cheaply. I haven't located a good usage tutorial for
the binary format and could use a guide if this is the
preferred method.

What do I do when I want to operate on a similarly
sized dynamic layer that I want to read/write to?

Tuple or List or Binary or something else?

The idea of each "location" being a process might be a
good idea for dynamic layers, but not for the base
terrain layer, which has no behaviors IMO.





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the erlang-questions mailing list