Order two numerical lists: Difference between revisions
Content deleted Content added
Line 865: | Line 865: | ||
=={{header|OCaml}}== |
=={{header|OCaml}}== |
||
The built-in comparison operators already do this: |
The built-in comparison operators already do this for lists (although this is not documented): |
||
<lang ocaml># [1;2;1;3;2] < [1;2;0;4;4;0;0;0];; |
<lang ocaml># [1;2;1;3;2] < [1;2;0;4;4;0;0;0];; |
||
- : bool = false</lang> |
- : bool = false</lang> |
||
(Warning: However, the built-in comparison operators do not do this for arrays: |
|||
<lang ocaml># [|1;2;1;3;2|] < [|1;2;0;4;4;0;0;0|];; |
|||
- : bool = true</lang> |
|||
) |
|||
But we could write it explicitly this way: |
But we could write it explicitly this way: |