Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners