Sort by Length for OCaml Golf Competition by kuenishi

let rec(!)=String.length
and g l=match try input_line stdin with _->""with""->l;|w->g(w::l)in
List.map print_endline(List.sort(fun l r->match!l- !r with 0->compare l r|d->d)(g[]))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page