Giter Club home page Giter Club logo

intro-ocaml's People

Watchers

 avatar  avatar  avatar

Forkers

fourchaux

intro-ocaml's Issues

Some Comments/Suggestions (file intro_ocaml.org)

Interesting intro ๐Ÿ˜ƒ

  • Typos:
    L149: maximun --> maximum
    L572: syntactilly --> syntactically

  • Code typos:

L315: let rec loop vars = --> let rec loop vars = function
L325: let rec loop vars = --> let rec loop vars = function

L825: "is_top"  is not defined?  
  
L866: let rec length match l with --> let rec length l = match l with  

L1043: fun v2 -> v1 + v2 --> fun v2 ->  Some (v1 + v2) ... Maybe?  

L1093: (Eq, Int 3, Int) --> (Eq, Int 3, Int 4) ... Maybe?

Something seems wrong with the last OCaml example. I have:

...

let al =
  List.map (( + ) max_int) [1;2;3;4;5;6;7;]
  |> addition_list ;;
(*
val al : t =
  Add (Int (-4611686018427387904),
   Add (Int (-4611686018427387903),
    Add (Int (-4611686018427387902),
     Add (Int (-4611686018427387901),
      Add (Int (-4611686018427387900),
       Add (Int (-4611686018427387899), Int (-4611686018427387898)))))))
*)

Format.printf "%a@." pp_expr al ;;
(*
-4611686018427387904 +
-4611686018427387903 +
-4611686018427387902 +
-4611686018427387901 +
-4611686018427387900 + -4611686018427387899 + -4611686018427387898
- : unit = ()
*)

Tests with OCaml 4.09.0.

  • Proposition:
    For each OCaml snippet, printing the results given by the REPL is useful, I think.
    Example:
let h = Hashtbl.create 7 ;;
(* val h : ('_weak1, '_weak2) Hashtbl.t = <abstr> *)

Hashtbl.add h 1 2 ;;
(* - : unit = () *)

Hashtbl.add h 1 3 ;;
(* - : unit = () *)

Hashtbl.iter (fun k v -> Format.printf "%d -> %d@." k v) h ;;
(*
1 -> 3
1 -> 2
- : unit = ()
*)
  • Missing:

More control structures: while ...
http://caml.inria.fr/pub/docs/manual-ocaml-4.09/expr.html#sec143

The 'lazy' expressions:
http://caml.inria.fr/pub/docs/manual-ocaml-4.09/coreexamples.html#sec15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.