How do I install a working version of Standard ML on Mac?

断了今生、忘了曾经 提交于 2019-12-01 00:34:46

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!