Wiki
Clone wikipopl / Getting Started with ML
Getting Started with Standard ML
For functional programming we use standard ML. There are many standard ml implementations of which we will be mostly concerned with
The two implementations serve a slightly different purpose and it is good to have both on your machine.
Stand alone executables
MLton provides a standard compiler that converts standard ml programs into machine code. If you want an efficient executable mlton is the way to go. However, to get the efficiency, mlton does a full program optimisation and as a result the compilation is slow. This is not good if you want to quickly try out some code.
Interactive development.
Although SML/NJ also provides a way to write standalone program, it is
basically an interpreter. So smlnj provides a convenient way to try
out code samples and get instant feedback. If your editor supports
integration with smlnj
(support is available for emacs and also vim
to some extent) then that is the best way to develop programs. When
you are done with development, you can then switch over to mlton and
compile the code for performance.
Have a look at this Vimeo video gives a
demonstration of how to efficiently work with git
, emacs
and
smlnj
.
The lab machines in the institute will have these tools installed. However, you might like to install these on your laptops. I recommend a modern GNU/Linux distribution for your developmental needs for this course. All these tools are available for free and most GNU/Linux distros or their BSD cousins should have prebuild packages for them. On a Debian based system the following commands will install all these tools for you.
sudo apt update sudo apt install smlnj smlnj-doc sudo apt install mlton
Some Debian derivatives do not seem to install the libsmlnj-smlnj
which has a lot of data structures useful for this course. Install
that as well.
sudo apt install libsmlnj-smlnj
References
There are many good books for programming in ML. I have added some which are online.
- ML for the Working Programmer, L C Paulson.
- Notes on Programming Standard ML of New Jersey, Riccardo Pucella.
- SML/NJ Users guide.
- Reference for the Standard ML Basis Library
- Additional utility library via SML/NJ library
- Modules useful for compiler building. I could not find a standard page for this modules.
- The SML-family homepage
Updated