changes
[lambda.git] / translating_between_OCaml_Scheme_and_Haskell.mdwn
index 69ba76d..48ac277 100644 (file)
@@ -148,7 +148,7 @@ We will however try to give some general advice about how to translate between O
 *      All About Monads has supposedly also been integrated into the Haskell wikibook
 *      (A not-so-)[Gentle Introduction to Haskell](http://web.archive.org/web/http://www.haskell.org/tutorial/) (archived)
 *      [Learn You a Haskell for Great Good](http://learnyouahaskell.com/)
-
+*      [Another page comparing Haskell and OCaml](http://blog.ezyang.com/2010/10/ocaml-for-haskellers/)
 
 ##Type expressions##
 
@@ -434,7 +434,7 @@ The syntax for declaring and using these is a little bit different in the two la
 
        In OCaml:
 
-               let { red = r; green = g } = c
+               let { red = r; green = g; _ } = c
                in r
 
        In Haskell:
@@ -448,7 +448,7 @@ The syntax for declaring and using these is a little bit different in the two la
 
        In OCaml it's:
 
-               # let makegray ({red = r} as c) = { c with green=r; blue=r };;
+               # let makegray ({ red = r; _ } as c) = { c with green=r; blue=r };;
                val makegray : color -> color = <fun>
                # makegray { red = 0; green = 127; blue = 255 };;
                - : color = {red = 0; green = 0; blue = 0}
@@ -466,9 +466,9 @@ The syntax for declaring and using these is a little bit different in the two la
        
        and then extract the field you want using pattern-matching:
 
-               let Color(r,_,_) = c;;
+               let Color (r, _, _) = c;;
                (* or *)
-               match c with Color(r,_,_) -> ...
+               match c with Color (r, _, _) -> ...
 
        (Or you could just use bare tuples, without the `Color` data constructor.)