smlnj - Printing only print output with SML/NJ -


i'm trying use sml/nj, , use sml < source.sml run code, prints out information.

for example, source.sml:

fun fac 0 = 1   | fac n = n * fac (n - 1) val r = fac 10 ; print(int.tostring(r)); 

this output:

standard ml of new jersey v110.77 [built: tue mar 10 07:03:24 2015] - val fac = fn : int -> int val r = 3628800 : int [autoloading] [library $smlnj-basis/basis.cm stable] [autoloading done] 3628800val = () : unit 

from suppress "val it" output in standard ml, how disable smlnj warnings?, , smlnj want remove "val = () : unit" every print statement execution, got hints how suppress them.

i execute cm_verbose=false sml < $filename , added 1 line of control.print.out := {say=fn _=>(), flush=fn()=>()}; in code, still have message:

standard ml of new jersey v110.77 [built: tue mar 10 07:03:24 2015] - 3628800 

how can print out output?

the sml command intended used interactively. sounds me better off building standalone executable program instead.

there few options:

  1. if relying on sml/nj extensions, or if cannot use ml implementation, can follow instructions in this post build sml/nj heap image can turned standalone executable using heap2exec.

  2. a better option might use mlton compiler, implementation of standard ml. lacks repl, unlike sml/nj requires no boilerplate generate standalone executable. building simple issuing:

    $ mlton your-program.sml $ ./your-program 3628800 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -