Sort using a custom comparator: Difference between revisions

Content added Content deleted
Line 336: Line 336:
let mycmp s1 s2 =
let mycmp s1 s2 =
if String.length s1 <> String.length s2 then
if String.length s1 <> String.length s2 then
String.length s2 - String.length s1
compare (String.length s2) (String.length s1)
else
else
String.compare (String.lowercase s1) (String.lowercase s2)
String.compare (String.lowercase s1) (String.lowercase s2)