Search code examples
smlsmlnjml

Can I create an Array with an Int64?


I basically want to create an array (Array.array(k + 1, 1)) but because k is of type Int64 (it has to be), I can't create the array (gives error), so I am trying to find a way to bypass that error. Any Ideas?

P.s the values of k < 20000 but it has to be stored as Int64.int.


Solution

  • Just convert to an integer with Int64.toInt:

    val k: Int64.int = ...
    val a = Array.array (Int64.toInt k + 1, 1)