views:

366

answers:

4

I really liked learning ML at college. I find functional programming often a refreshingly elegant way to write certain algorithms. I have heard of F# and played around with that a bit. Still, I've written some interesting functions in ML and would like to integrate them as libraries I could use in other applications.

Usually I paste my functions into the SMLnj interpreter. Is there a way I can compile them down?

+6  A: 

You will have to use something like the MLj Compiler. It compiles to Java Byte code. Or you can use the SML.NET compiler to compile to .NET IL.

Vincent Ramdhanie
Beautiful, those both look like two good options.
Chet
+2  A: 

It is common amongst ML for both sides to export to C and then call each others C functions. Just about everything has a FFI library for 'easily' exporting to C.

http://www.smlnj.org/doc/SMLNJ-C/index.html

so to the outside world your sml library would behave like a C library except with out the assiciated segfaults and memory leaks*

*not a guarantee

Arthur Ulfeldt
+1  A: 

Projects popularize languages. Do the ground work for an interesting and undeniably 'cool' project using ML, and people will flock to the language. For instance,look at Erlang with ejabberd and mochiweb - both cool projects that have done wonders for a one-time-diamond-in-the-rough language like erlang (which is, btw, my development language of choice lately). I for one, would love to see somebody make something rad with ML, the language is a joy to think with.

+1  A: 

There are several Standard ML compilers. The MLton wiki also contains a benchmark.

I used Moscow ML which compiles Standard ML into bytecode. It's not fast, but it works. MLton is often cited to be the best Standard ML compiler with regard to efficiency.

ott