diff options
author | Adam Bard <github@adambard.com> | 2016-03-26 14:16:24 -0700 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2016-03-26 14:16:24 -0700 |
commit | de993590ac70e48a49938b5a8d6bac763694e5c1 (patch) | |
tree | 6332ba11c597f14818a04de605fce5e414c0d792 | |
parent | 3d6cf715df4ced9854243f30ad40937be68b656e (diff) | |
parent | a69b31cd3e2a29bbe130be4b90d1a8d0d72a813b (diff) |
Merge pull request #2208 from juan70/ocaml-filter
Change anonymous function in List.filter example
-rw-r--r-- | ocaml.html.markdown | 2 |
1 files changed, 1 insertions, 1 deletions
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". *) |