[erlang-questions] 2D Map Arrays

Richard Carlsson richardc@REDACTED
Mon Sep 11 20:31:42 CEST 2006


Jeff Crane wrote:
> Can anyone post example usage for the Array
> implementation? 
> 
> I'd like to see proper usage.
> 
> %% yes I imported the array module, after compiling
> test() ->
> 	MyArr = array:new(0,0),
> 	array:push(1,4,MyArr).
> 
> This is about as far as I got.

'push' is not an exported function, so don't even try to
use it. It's just a help function that works on lists.
Rule number one: if it's not exported and not documented,
then it doesn't exist.

On the other hand, there _is_ a heap of unit testing code
inside the module, with plenty of usage examples.

> How do you identify individual arrays?

What do you mean by "identify"?

> New doesnt always return me a value.

That sounds awfully strange. Do you mean that the 'new'
function loops forever? Can you show an example?

> How do I push a value into the array?

Use the 'set' function. I will probably add some
extra functions such as 'append' later.

> Does it dynamically resize?

Yes.

> I cannot determine the answers to these questions by looking at
> the code/trying test args.

Did you not see the html documentation
(http://user.it.uu.se/~richardc/array/array.html)?

	/Richard



More information about the erlang-questions mailing list