summaryrefslogtreecommitdiffhomepage
path: root/ocaml.html.markdown
diff options
context:
space:
mode:
authorLuis Custodio <luis.custodio@gmail.com>2015-10-17 13:11:25 +0200
committerLuis Custodio <luis.custodio@gmail.com>2015-10-17 13:11:25 +0200
commitf5873b08901bfaec3fb46518258ff9e886fd04c4 (patch)
tree62886b71c7226f0c6c4f979d61ff96c839a641a9 /ocaml.html.markdown
parentc9348e5a82b639093f8f3eee955ffdf6fb99b5d8 (diff)
parent0e6d9f6fe9aeffc64c3adad3e4a0ee1cc0d1dd88 (diff)
Merge branch 'master' of github.com:adambard/learnxinyminutes-docs
Diffstat (limited to 'ocaml.html.markdown')
-rw-r--r--ocaml.html.markdown12
1 files changed, 6 insertions, 6 deletions
diff --git a/ocaml.html.markdown b/ocaml.html.markdown
index b0027fea..02435e4d 100644
--- a/ocaml.html.markdown
+++ b/ocaml.html.markdown
@@ -34,13 +34,13 @@ For a source file you can use "ocamlc -i /path/to/file.ml" command
to print all names and type signatures.
```
-$ cat sigtest.ml
+$ cat sigtest.ml
let inc x = x + 1
let add x y = x + y
-let a = 1
+let a = 1
-$ ocamlc -i ./sigtest.ml
+$ ocamlc -i ./sigtest.ml
val inc : int -> int
val add : int -> int -> int
val a : int
@@ -104,7 +104,7 @@ let fact_4 = factorial (5-1) ;;
let sqr2 = sqr (-2) ;;
(* Every function must have at least one argument.
- Since some funcions naturally don't take any arguments, there's
+ Since some funcions naturally don't take any arguments, there's
"unit" type for it that has the only one value written as "()" *)
let print_hello () = print_endline "hello world" ;;
@@ -301,7 +301,7 @@ let l = IntList (1, EmptyList) ;;
(* Pattern matching is somewhat similar to switch statement in imperative
languages, but offers a lot more expressive power.
- Even though it may look complicated, it really boils down to matching
+ Even though it may look complicated, it really boils down to matching
an argument against an exact value, a predicate, or a type constructor.
The type system is what makes it so powerful. *)
@@ -320,7 +320,7 @@ let is_one = function
;;
(* Matching predicates, aka "guarded pattern matching". *)
-let abs x =
+let abs x =
match x with
| x when x < 0 -> -x
| _ -> x