Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
juan70 committed Mar 26, 2016
1 parent 3d6cf71 commit a69b31c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ocaml.html.markdown
Expand Up @@ -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". *)
Expand Down

0 comments on commit a69b31c

Please sign in to comment.