Standard ML: how to compile ML program with mosmlc?

I would like to compile my ML program into an executable binary using mosmlc. However, I could not find much information on how to do this.

The code I would like to compile is here http://people.pwf.cam.ac.uk/bt288/tick6s.sml

cx, cy, s, imgLocation are 4 arguments that I would like to use from command line arguments. For example, if the program is compiled with a name mandelbrot, the input bash$mandelbrot -0.5 0.15 0.0099 image.pngshould perform the main function.

+3
source share
1 answer

You can put this code in a file foo.smland run

mosmlc -P full foo.sml

, CommandLine.arguments, , ,

val (cx, cy, s, imgLocation) = 
  case CommandLine.arguments () 
    of [a, b, c, d] -> (a, b, c, d)
     | _ -> (usage(); Process.exit Process.failure)

usage.


P.S. mosmlc, , , mosml, help string -> unit.

+2

Source: https://habr.com/ru/post/1727115/


All Articles