Last active
December 16, 2015 01:41
-
-
Save ship561/2e3f3664c2f0bf3676f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn bar [input] | |
(let [xf1 (partial re-seq #"[-\w]+") | |
xf2 (fn [[x & ys]] | |
[x | |
(->> ys | |
(map-indexed #(if (odd? %1) | |
(read-string %2) | |
%2)) | |
(apply assoc {}))])] | |
(transduce (comp (map xf1) | |
(map xf2)) | |
(completing (fn [m kvs] | |
(apply assoc m kvs))) | |
{} | |
(str/split-lines input)))) | |
(def foo "one property1 1, property2 1\ntwo property1 2, property2 2\nthree property1 3, property2 3\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment