I'm using Mac OSX 10.7.5 and I can't seem to get download a working Standard ML compiler with a REPL available. Is this supposed to be so difficult? Is there a best ML that I should be downloading. I've tried SML/NJ and MLton to no avail.
I did the following:
--download appropriate(for your operating system) .dmg file from http://www.smlnj.org/dist/working/110.75/
--in your ~/.bash_profile: export PATH="$PATH:/usr/local/smlnj-110.75/bin"
--run your bash_profile by doing source .bash_profile
--go to terminal and type sml.
I personally use sml mode for emacs. Add the following to your .emacs file and make sure that sml mode is installed in your emacs from M-list-packages.
(setenv "PATH" (concat "/usr/local/smlnj-110.75/bin:" (getenv "PATH")))
(setq exec-path (cons "/usr/local/smlnj-110.75/bin" exec-path))
You can start sml REPL in emacs by doing C-c C-s.
I downloaded SML/NJ 110.76 for Mac OS X package from http://www.smlnj.org/dist/working/110.76/index.html
and then installed it, and access it at /usr/local/smlnj/bin/sml
A Mac user can also use
$ brew install smlnj
Add path similar to /usr/local/Cellar/smlnj/110.82/libexec/bin
to your .bash_profile.
$ source ~/.bash_profile
See this article for more information.
You can try Moscow ML from http://mosml.org/ - there is also a mosml-2.10.1.pkg available for OS X. Moscow ML is generally less popular than SML/NJ but has a very fine REPL with comprehensible error messages. It is an excellent learning environment.
If you don't mind a somewhat big download using approx. 600 MB disk space, you can try Isabelle/ML. Isabelle is mainly a theorem proving environment, but it is based on Poly/ML including a reasonably IDE: Isabelle/jEdit.
To write SML in Isabelle/ML, it needs to be incorporated into theory sources like this:
theory Scratch
imports Main
begin
ML {* fun f 0 = 1 | f n = n * f (n - 1) *}
ML {* f 42 *}
end
来源:https://stackoverflow.com/questions/19024116/how-do-i-install-a-working-version-of-standard-ml-on-mac