Skip to content

Instantly share code, notes, and snippets.

@Raynes Raynes/gist:219995
Created Oct 27, 2009

Embed
What would you like to do?
(ns main.test
(:use clojure.contrib.str-utils
[clojure.contrib.duck-streams :only (spit)]))
(def input "Source.txt")
(def output "red.txt")
(defn remove-newlines
"Removes all \ns from the string."
[s]
(apply str (remove #(= % \newline) s)))
(defn get-nums [s]
(last (.split s ">")))
(defn find-nums [s]
(let [parted (re-partition #"<font color=\"red\">[0-9]+" s)]
(map get-nums (map first (partition 1 2 (rest parted))))))
(defn spit-nums [s]
(spit output (apply str (interpose "\n" s))))
(defn main []
(spit-nums (find-nums (remove-newlines (slurp input)))))
(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.