Extremely simple and basic programs.

Calling the Caml compiler:
  to compile the file hello.ml to executable program a.out type
    ocamlc hello.ml
  to compile the file hello.ml to executable program hello type
    ocamlc -o hello hello.ml

To try interactively:

        ocaml               # or ledit ocaml if ledit is installed.
        #use "loadall.ml";;

This directory contains the following programs:

 Hello: source programm is in file hello.ml.
  Just prints Hello world! followed by a newline.
  Try
       hello

 Greeting: source programm is in file greeting.ml.
  Ask the name of the user, reads the input at keyboard, greets the
  user and die.
  Try
       greeting

 Square: source program is in file square.ml
  Reads an integer passed as argument to the program, then compute
  and prints its square.
  Try
        square 16

 Fib: source program is in fib.ml.
  Define the Fibonacci function as a simple recursive Caml function.
  Try
        fib 10

 Wc: the source program is in wc.ml.
  A program that mimicks the Unix "wc" utility: it counts the number of
  characters, words, and lines of a given file.
  Try
        ./wc wc.ml

 Wc_unix: the source program is in wc_unix.ml.
  A Caml clone of the Unix "wc" utility.
  Try
        ./wc_unix *.ml

 Strstr: the source program is in strstr.ml.
  Tests if its first argument appears as a sub string of its second
  argument, and returns the character number of the first matching
  occurrence.
  Uses imperative programming, while loops and references.
  Try
        strstr rs strstr
        strstr ra strstr

 Sieve: the source program is in sieve.ml.
  The Eratosthene's sieve: the program computes the set of prime
  numbers lesser than a given integer argument.
  Uses lists.
  Try
        sieve 1000

 Qeens: the source program is in queens.ml.
  Lists manipulation: prints the solution to the 8 queens problem.
  How to set n queens on a chessboard of size n such that none
  can catch one each other.
  Try
        queens 8

 Soli: the source program is in soli.ml.
  Prints the solution to the famous ``solitaire'' game.
  Vectors and data types definitions and manipulation.
  Try
        soli

To compile: either type "make", or, by hand:

        ocamlc -o fib fib.ml
        ocamlc -o wc wc.ml
        ocamlc -o sieve sieve.ml

To run:

        fib 10              # or some other number
        wc fib.ml           # or some other files
        sieve 1000          # or some other number

To compile to native code: either "make opt", or, by hand:

        ocamlopt -o fib fib.ml
        ocamlopt -o wc wc.ml
        ocamlopt -o sieve sieve.ml

To try interactively:

        ocaml               # or ledit ocaml if ledit is installed.
        #use "loadall.ml";;

