Skip to content

Instantly share code, notes, and snippets.

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

What would you like to do?
(ns main.test
(:use clojure.contrib.str-utils
[ :only (spit)]))
(def input "Source.txt")
(def output "red.txt")
(defn remove-newlines
"Removes all \ns from the string."
(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)))))
You can’t perform that action at this time.