Skip to content

Instantly share code, notes, and snippets.

@tk3
Last active August 19, 2018 14:58
Show Gist options
  • Save tk3/c991c9cb6df69fb16839cd42949557d1 to your computer and use it in GitHub Desktop.
Save tk3/c991c9cb6df69fb16839cd42949557d1 to your computer and use it in GitHub Desktop.
OCaml

OCaml

環境

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

OCaml をインストール

OPAM 経由で OCaml をインストールする。OPAM でのインストール
デフォルトで 4.05.0 がインストールされるが、その後に最新版(この時は 4.07.0 )をインストールする。

$ wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin
$ opam init
$ opam switch
$ opam switch --installed
4.05.0 C 4.05.0  Official 4.05.0 release

[WARNING] The environment is not in sync with the current switch.
          You should run: eval `opam config env`

$ opam switch 4.07.0

次回以降で設定有効になるように設定を .bashrc に追加する

echo 'eval `opam config env`' >> ~/.bashr

REPL で遊ぶ

ocaml コマンドで REPL 環境を起動することができる。

$ ocaml
        OCaml version 4.07.0

#

インストールされるコマンド一覧。コマンド一覧は 4.07.0 のもの

ocaml
ocamlc
ocamlc.byte
ocamlcmt
ocamlc.opt
ocamlcp
ocamlcp.byte
ocamlcp.opt
ocamldebug
ocamldep
ocamldep.byte
ocamldep.opt
ocamldoc
ocamldoc.opt
ocaml-instr-graph
ocaml-instr-report
ocamllex
ocamllex.byte
ocamllex.opt
ocamlmklib
ocamlmklib.byte
ocamlmklib.opt
ocamlmktop
ocamlmktop.byte
ocamlmktop.opt
ocamlobjinfo
ocamlobjinfo.byte
ocamlobjinfo.opt
ocamlopt
ocamlopt.byte
ocamlopt.opt
ocamloptp
ocamloptp.byte
ocamloptp.opt
ocamlprof
ocamlprof.byte
ocamlprof.opt
ocamlrun
ocamlrund
ocamlruni
ocamlyacc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment