OCaml Primer (2)

Source: Internet
Author: User
Tags ocaml

Assuming you have installed the Opam with SU permissions on the CENTOS7, return to normal permissions below. Use Opam to install something else.

Opam installation of things, by default in the ~/.opam directory, it does not have permissions to change the system directory of things.

If there is a problem with the configuration, it is simple. Delete ~/.opam directory, everything NEW!

1. Opam Init

Initialize the environment, go all the way yes.

Test whether the criteria for success, see if the environment variables are added well:

Printenv Ocaml_toplevel_path

Sometimes, you might need to perform the following instructions:

Eval ' opam config env '

Note that it is an anti-quote.

2. Opam switch

To check the version number of the compiler, you should switch to the following version:

Opam Switch 4.01.0

This may take some time to wait patiently for the prompt to appear.

Eval ' opam config env '

Refresh the loop change

3. Opam Install core Utop

Install two important packages: core and Utop

In learning "real world OCaml", often used in the core package of things, it must be installed.

Utop offers more powerful features than the toplevel environment that OCaml comes with. such as code auto-completion, convenient document query and so on.

4. Edit the. ocamlinit file

Add the following content:

#use "Topfind";;
#thread;;
#camlp4o;;
#require "Core.top";;
#require "Core.syntax";;

In this way, each time you start Utop, these features will be loaded automatically.

Many of the books are in need of CORE.STD package support, so, after entering Utop, do not forget:

Open core.std;;

5. Start Utop

Now, the environment is ready, you can follow the "real World OCaml" study.

OCaml Primer (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.