Skip to content

Instantly share code, notes, and snippets.

@glv
Created October 17, 2013 16:18
Show Gist options
  • Save glv/7027832 to your computer and use it in GitHub Desktop.
Save glv/7027832 to your computer and use it in GitHub Desktop.
Avdi Grimm praised the symmetry of the Clojure version of line sorting (http://devblog.avdi.org/2013/10/16/sorting-lines-in-5-languages/). I thought it would be instructive to show how a more traditional Lispy version, without Clojure's ->> macro, obscures that symmetry.
(spit (nth *command-line-args* 2)
(clojure.string/join "\n"
(sort (clojure.string/split-lines (slurp (nth *command-line-args* 1))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment