rlm@0: (ns coderloop.reverse-sentence rlm@0: (:refer-clojure :only []) rlm@0: (:require rlm.ns-rlm rlm.light-base)) rlm@0: (rlm.ns-rlm/ns-clone rlm.light-base) rlm@0: rlm@0: rlm@0: (undef partition) rlm@0: (use '[clojure.contrib [string :only [partition]]]) rlm@0: (use '[clojure [string :only [blank?]]]) rlm@0: rlm@0: (defn reverse-line [s] rlm@0: (apply str rlm@0: (flatten rlm@0: (map #(if (re-matches #"\w" (str (first %))) (reverse %) %) rlm@0: (filter (comp not (partial = "")) rlm@0: (partition #"\w+" s)))))) rlm@0: rlm@0: rlm@0: (defn reverse-file [file] rlm@0: (doall rlm@0: (map println rlm@0: (map reverse-line rlm@0: (read-lines file))))) rlm@0: rlm@0: rlm@0: (if (command-line?) rlm@0: (reverse-file (first *command-line-args*))) rlm@0: