Greatest element of a list: Difference between revisions
Content deleted Content added
→{{header|Python}}: Simplified stream handling |
|||
Line 185: | Line 185: | ||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
<ocaml> |
<ocaml>let my_max = function |
||
[] -> invalid_arg "empty list" |
|||
let rec my_max = function |
|||
⚫ | |||
[] -> raise Empty_list |
|||
| [x] -> x |
|||
# my_max [4;3;5;9;2;3] ;; |
|||
⚫ | |||
- : int = 9 |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |