From 95bb627df8d5adebcb99f02088a8fc7acee94255 Mon Sep 17 00:00:00 2001 From: Jearvon Dharrie Date: Fri, 26 Feb 2016 17:43:41 -0500 Subject: Fix typo --- ocaml.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ocaml.html.markdown') diff --git a/ocaml.html.markdown b/ocaml.html.markdown index 8faab297..a346550c 100644 --- a/ocaml.html.markdown +++ b/ocaml.html.markdown @@ -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 functions 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" ;; -- cgit v1.2.3 From a69b31cd3e2a29bbe130be4b90d1a8d0d72a813b Mon Sep 17 00:00:00 2001 From: juan70 Date: Sat, 26 Mar 2016 12:27:56 +0000 Subject: Change anonymous function in List.filter example Change into what is supposed to be better style, or maybe a more idiomatic way of writing the predicate. --- ocaml.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ocaml.html.markdown') diff --git a/ocaml.html.markdown b/ocaml.html.markdown index a346550c..59ead9ec 100644 --- a/ocaml.html.markdown +++ b/ocaml.html.markdown @@ -216,7 +216,7 @@ List.nth my_list 1 ;; (* There are higher-order functions for lists such as map and filter. *) List.map (fun x -> x * 2) [1; 2; 3] ;; -List.filter (fun x -> if x mod 2 = 0 then true else false) [1; 2; 3; 4] ;; +List.filter (fun x -> x mod 2 = 0) [1; 2; 3; 4] ;; (* You can add an item to the beginning of a list with the "::" constructor often referred to as "cons". *) -- cgit v1.2.3