Skip to content

Instantly share code, notes, and snippets.

@scarcher2
Created August 26, 2014 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scarcher2/aa761ba50424cb91e46b to your computer and use it in GitHub Desktop.
Save scarcher2/aa761ba50424cb91e46b to your computer and use it in GitHub Desktop.
Clojure Transform Attempt
(ns sample.core)
(use '[clojure.data.xml :as data.xml])
(use '[clojure.java.io :as io])
(defn process-contact
"I don't do a whole lot."
[contact]
(println contact)
(println (:content (:first (:content contact))))
[:id (:id (:attrs contact)) :first-name (:first (:content contact)) :last-name (:last (:content contact)) :email-address (:email (:content contact))]
)
(defn contact-seq
"Test"
[rdr]
(->> (:content (data.xml/parse rdr))
(filter #(= :contact (:tag %)))
(map process-contact)))
(defn run-sample
"FUN"
[]
(contact-seq (io/input-stream "contacts.xml")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment