How to pass two dimensional array to a function in F#? -


i trying create function in f# takes input 2 dimensional array of integers (9 9), , prints content afterwards. following code shows have done :

let printmatrix matrix=     in 0 .. 8         j in 0 .. 8             printf "%d " matrix.[i,j]         printf "\n" 

the problem f# not automatically infer type of matrix, , gives me following error: "the operator 'expr.[idx]' has been used object of indeterminate type based on information prior program point. consider adding further type constraints".

i tried use type annotation in definition of function, think did wrong. idea how can overcome issue?

change

let printmatrix (matrix:int [,])=     in 0 .. 8         j in 0 .. 8             printf "%d " matrix.[i,j]         printf "\n" 

this due how f# type infrence algorithm works


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -