OCaml

  1. Instala la última versión de opam:

     alumno@servidor:~ $ wget \
         https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux -O $HOME/.local/bin
     alumno@servidor:~ $ chmod +x $HOME/.local/bin
    

    Inicializa ~/.opam:

     alumno@servidor:~ $ opam init
     Checking for available remotes: rsync and local, git.
       - you won't be able to use mercurial repositories unless you install the hg command on your system.
       - you won't be able to use darcs repositories unless you install the darcs command on your system.
     [WARNING] Recommended external solver aspcud not found.
     [ERROR] No OCaml compiler found in path. You should use:
                 opam init --comp=VERSION
     [ERROR] Initialisation failed
     OpamGlobals.Exit(66)
    
  2. Instala a OCaml:

     alumno@servidor:~ $ opam init --comp 4.03.0
     Checking for available remotes: rsync and local, git.
       - you won't be able to use mercurial repositories unless you install the hg command on your system.
       - you won't be able to use darcs repositories unless you install the darcs command on your system.
     [WARNING] Recommended external solver aspcud not found.
     =-=- Fetching repository information =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     [default] synchronized from https://opam.ocaml.org
     =-=- Installing compiler 4.03.0 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     [compiler.get] https://github.com/ocaml/ocaml/archive/4.03.0.tar.gz downloaded
     Now compiling OCaml. This may take a while, please bear with us...
     Done.
     =-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     =-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     ∗  installed base-bigarray.base
     ∗  installed base-threads.base
     ∗  installed base-unix.base
     Done.
     In normal operation, OPAM only alters files within ~/.opam.
     During this initialisation, you can allow OPAM to add information to two
     other files for best results. You can also make these additions manually
     if you wish.
     If you agree, OPAM will modify:
       - ~/.bash_profile (or a file you specify) to set the right environment
         variables and to load the auto-completion scripts for your shell (bash)
         on startup. Specifically, it checks for and appends the following line:
         . /home/alumno/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
       - ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
         (i.e. those installed by OPAM) will work correctly when running the
         OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
         of include directories.
     If you choose to not configure your system now, you can either configure
     OPAM manually (instructions will be displayed) or launch the automatic setup
     later by running:
        opam config setup -a
     Do you want OPAM to modify ~/.bash_profile and ~/.ocamlinit?
     (default is 'no', use 'f' to name a file other than ~/.bash_profile)
         [N/y/f] n
     Global configuration:
       Updating ~/.opam/opam-init/init.sh
       Updating ~/.opam/opam-init/init.zsh
       Updating ~/.opam/opam-init/init.csh
       Updating ~/.opam/opam-init/init.fish
     =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
     1. To configure OPAM in the current shell session, you need to run:
           eval `opam config env`
     2. To correctly configure OPAM for subsequent use, add the following
        line to your profile file (for instance ~/.bash_profile):
           . /home/alumno/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
     3. To avoid issues related to non-system installations of `ocamlfind`
        add the following lines to ~/.ocamlinit (create it if necessary):
           let () =
             try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
             with Not_found -> ()
           ;;
     =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    
  3. Edita $HOME/.bashrc:

     . $HOME/.opam/opam-init/init.sh /dev/null 2> /dev/null || true
    
  4. Edita o crea el archivo $HOME/.ocamlinit con lo siguiente:

     let () =
         try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
         with Not_found -> ()
     ;;
    

UTop

utop - a universal toplevel for OCaml

alumno@servidor:~ $ opam install utop
The following actions will be performed:
  ∗  install conf-pkg-config 1.0              [required by conf-ncurses]
  ∗  install conf-m4         1                [required by ocamlfind]
  ∗  install conf-which      1                [required by camlp4]
  ∗  install ocamlbuild      0.9.3            [required by utop]
  ∗  install conf-ncurses    1                [required by lwt]
  ∗  install ocamlfind       1.6.2            [required by utop]
  ∗  install camlp4          4.03+1           [required by utop]
  ∗  install react           1.2.0            [required by utop]
  ∗  install cppo            1.4.0            [required by utop]
  ∗  install camomile        0.8.5            [required by zed]
  ∗  install lwt             2.4.5            [required by utop]
  ∗  install zed             1.3              [required by lambda-term]
  ∗  install lambda-term     1.10.1           [required by utop]
  ∗  install utop            1.19.3
===== ∗  14 =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] https://opam.ocaml.org/archives/cppo.1.4.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/camlp4.4.03+1+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/lambda-term.1.10.1+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/lwt.2.4.5+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ocamlbuild.0.9.3+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/ocamlfind.1.6.2+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/react.1.2.0+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/zed.1.3+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/utop.1.19.3+opam.tar.gz downloaded
[default] https://opam.ocaml.org/archives/camomile.0.8.5+opam.tar.gz downloaded

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
∗  installed conf-m4.1
∗  installed conf-pkg-config.1.0
∗  installed conf-ncurses.1
∗  installed conf-which.1
∗  installed ocamlbuild.0.9.3
∗  installed ocamlfind.1.6.2
∗  installed react.1.2.0
∗  installed cppo.1.4.0
∗  installed camomile.0.8.5
∗  installed zed.1.3
∗  installed camlp4.4.03+1
∗  installed lwt.2.4.5
∗  installed lambda-term.1.10.1
∗  installed utop.1.19.3
Done.

alumno@servidor:~ $ which utop
/home/alumno/.opam/4.03.0/bin/utop

alumno@servidor:~ $ utop
───────────┬──────────────────────────────────────────────────────────────┬────────────
           │ Welcome to utop version 1.19.3 (using OCaml version 4.03.0)! │            
           └──────────────────────────────────────────────────────────────┘            

Type #utop_help for help about using utop.

─( 21:23:11 )─< command 0 >─────────────────────────────────────────────{ counter: 0 }─
utop # 
┌───┬────────────┬─────┬───────────┬──────────────┬───────┬────────┬──────┬─────┬─────┐
│Arg│Arith_status│Array│ArrayLabels│Assert_failure│Big_int│Bigarray│Buffer│Bytes│Bytes│
└───┴────────────┴─────┴───────────┴──────────────┴───────┴────────┴──────┴─────┴─────┘