(ns github-langs (:use [clojure.contrib.duck-streams :only [slurp*]])) (defn rank [page] (rest (re-find #"\<h1\>(.*)\</h1\>\n +\<h3\>is the #(.*) most popular" page))) (let [langs ["ActionScript" "Arc" "C" "C%20Sharp" "C++" "Clojure" "Common%20Lisp" "D" "Eiffel" "Emacs%20Lisp" "Erlang" "FORTRAN" "Groovy" "Haskell" "Io" "Java" "JavaScript" "Lua" "Max%2fMSP" "Nu" "Objective-C" "OCaml" "ooc" "Perl" "PHP" "Pure Data" "Python" "R" "Ruby" "Scala" "Scheme" "sclang" "Self" "Shell" "Smalltalk" "SuperCollider" "Tcl" "Verilog" "VHDL" "VimL" "Visual Basic"] pages (map #(slurp* (str "http://github.com/languages/" %)) langs) ranks (filter first (map rank pages))] (map first (sort-by #(Integer. (last %)) ranks)))