0

Is it possible to export a Standard ML function such as

fun fac 0 = 1
  | fac n = n * fac (n - 1);

To a respective JavaScript function, via Emscripten?

I know the compilation can be done, but I'm not sure how exactly you would access "fac" from JS code.

MaiaVictor
  • 51,090
  • 44
  • 144
  • 286
  • Can you explain why (and how) you want to go via Emscripten? Why not simply use a compiler like SMLtoJS (http://www.smlserver.org/smltojs/)? – Andreas Rossberg Jan 04 '14 at 09:40
  • @AndreasRossberg because correct me if I'm wrong (the site is offline s of now so I can't know), I guess it does not use MLTon. – MaiaVictor Jan 04 '14 at 12:26
  • No, it's based on the MLKit. But how does that matter? If it is performance you worry about then there are far more relevant factors to consider in this scenario than the amount of offline optimisations. For example, not having another runtime and memory system nested into the JavaScript one. – Andreas Rossberg Jan 04 '14 at 13:38
  • I would agree with @AndreasRossberg, first compile to JS and if that works see what other features you need. – abergmeier Jan 05 '14 at 08:57

0 Answers0