SML: syntax error: replacing FUN with VAL -


i trying write function in ml works loop (yes know not how language supposed work). here code far:

fun (f:int->unit) start_i:int end_i:int =  let fun for2 (f:int->unit) start_i:int end_i:int i:int =     if i=end_i - 1         f     else         (f i;         for2 f start_i end_i (i + 1)) in     for2 f start_i end_i start_i end 

but sml (and ocaml too) giving me error:

test.ml:1.2-1.5 error: syntax error: replacing  fun  val test.ml:2.6-2.9 error: syntax error: replacing  fun  val 

so, there wrong function's signature. can't find is. can me?

thanks

not sure if compiles in ocaml (is f#) version of interactive not complaining is:

let rec for2 (body: int->unit) istart iend =     if istart = iend ()     else         body istart;         for2 body (istart+1) iend 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -