Skip to content
An interactive tutorial to begin learning with OCaml
JavaScript OCaml Other
Latest commit ddd533d Feb 24, 2015 @OCamlPro-Bozman OCamlPro-Bozman Merge pull request #152 from mkoconnor/master
fix 2 typos
Failed to load latest commit information.
cmicomp update Makefiles and files for 4.01.0 Oct 18, 2013
js_of_ocaml-lessons Fix english typo in js_of_ocaml lessons Feb 3, 2013
ocaml-lessons Fix typo: "it's" --> "its" Nov 17, 2014
ocaml-num Merge pull request #123 from lefessan/without_js_of_ocaml Jul 5, 2013
ocp-jslib @ 5251af9 ocp-jslib as git submodule Nov 19, 2013
toplevel
toplevellib update Makefiles and files for 4.01.0 Oct 18, 2013
try-js_of_ocaml style.css: Make cursor pointer on executable code Jan 3, 2015
try-ocaml fix another typo Feb 20, 2015
tutorial remove read_bool and rename read_string in read_line Oct 18, 2013
.depend Add untracked files and update index.html Feb 6, 2013
.gitignore Requires latest ocp-build Feb 16, 2013
.gitmodules ocp-jslib as git submodule Nov 19, 2013
Makefile update Makefiles and files for 4.01.0 Oct 18, 2013
Makefile.tryocaml update Makefiles and files for 4.01.0 Oct 18, 2013
README.md
configure Update for 4.01 and new version of ocp-build Jul 5, 2013
tryocaml.ocp Update for 4.01 and new version of ocp-build Jul 5, 2013

README.md

Overview

TryOCaml is the easiest way to learn how to code in OCaml language. A funny way to learn the language. It is available here:

http://try.ocamlpro.com/

TryOCaml is based on (http://ocsigen.org/js_of_ocaml/files/toplevel/index.html) built with js_of_ocaml (see http://ocsigen.org/js_of_ocaml/).

Requirements

Try it

$ opam remote add devel git@github.com:OCamlPro/opam-repo-dev.git
$ opam install js_of_ocaml.100
$ git submodule init
$ git submodule update
$ ./configure
$ make

Then, with your favorite browser launch tryocaml/index.html:

$ chromium-browser tryocaml/index.html

Contribute lessons/steps/fixes

Lessons are in the "lessons/" top directory.

Each lesson is a sub-directory "lessonN", where N is the lesson number, and contains a file "lesson.html", with a title in a <h3> tag on the first line, and a set of steps. Each step is a sub-directory "stepM" of "lessons/lessonN", where M is the step number in the lesson.

Each step is composed of two files:

  • "step.html": the text of the step. The first line MUST contain the step title, in a <h3> tag. Code that should be copied in the terminal should be in <code> tags.
  • "step.ml": the function testing if the step has been completed. It takes the user input (a string) and the compiler output (a string) as arguments, and returns a boolean, true if the user has succeeded, false otherwise. "step.ml" can directly use functions defined in "lessons/goodies.ml" (that is included, so NEVER use "open Goodies" or "Goodies.something), in particular the "find_in" function.

To recompile when you have done a modification:

$ make update-lessons

Failure to comply to the lesson/step specification will make the tryocaml/tutorial/make_lessons command fail.

If you want to debug at some point, you can type debug true in the terminal to see what the input and output strings are.

Once everything works, send a "pull request" via Github, or send us a patch. You can also come on #ocamlpro IRC channel to discuss with us.

Online

http://try.ocamlpro.com/

License

GNU General Public License

Something went wrong with that request. Please try again.