Sort by Length for OCaml Golf Competition by shimomura

open List\x0d
let rec i?(s=ref[])?(l=read_line())_=try s:=l::!s;i~s()with e-> !s;;\x0d
map(Printf.printf"%s\n")(sort(fun?(k=String.length)a b->let n=k a-k b in(abs n-1)*compare b a+n)(i()));;

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

download

return to the top page