Getting error unbound variable or constructor

542 views Asked by At

The code is running fine on online Standard ML of New Jersey v110.78 but showing error on unix SNL/NJ .93. here is the code

fun check( num:int ) = 

 let
   val x = List.tabulate(num, fn x => x*x)
   val k =tl(x)
   val y = List.filter( fn z => num mod z = 0)k
   val ans = List.last(y)
   val final = Real.ceil(Math.sqrt (Real.fromInt ans))
 in
 final
 end;
val nu = check(8)

Errors are Unbound constructor or variable in tabulate, filter, last, ceil and unbound structure for Math.

1

There are 1 answers

0
sshine On BEST ANSWER

It sounds like your standard library in this SML/NJ .93 is not properly configured. If you read the StackOverflow Q&A how to install SML-New jersey .93 version? you'll see that

SMLNJ version 0.93 was released in 1993. It is available for historical purposes. [...] It was never tested on any version of Microsoft Windows [...] It is highly unlikely to run natively under Windows [...]

I would recommend against using this version unless you're willing to deal with the consequences of running software that was not designed for the operating systems of our time, whether that is Windows or something else.