Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Request: matrix_init function in Array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-02-10 (23:23)
From: Pierre Weis <pierre.weis@i...>
Subject: Re: [Caml-list] Request: matrix_init function in Array
> Any possibility we could add the following function to the Array module?
> val matrix_init : int -> int -> (int -> int -> 'a) -> 'a array array
> let matrix_init rows cols f =
>     let g i = init cols (f i)
>     in
>     init rows g
> ;;
> Actually, I'm not sure if the function should be matrix_init or 
> init_matrix.  And I don't care either way.
> Brian

I think we need a Matrix module, such that it would be Matrix.init,
Matrix.make, and so on.

This would be much more convenient for beginners that are always
caught by the famous Array.make raw (Array.make column 0.0).

Hope this helps.

Pierre Weis

INRIA, Projet Cristal,,

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: