Skip to content

Instantly share code, notes, and snippets.

@brehaut
Created March 27, 2011 05:13
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 brehaut/888932 to your computer and use it in GitHub Desktop.
Save brehaut/888932 to your computer and use it in GitHub Desktop.
(->> (re-seq #"(?i)(\d+)\.|(yes|no)" "no1. asdf\n\nasdf foo yes2.\n\nfsdf\nno yes no")
(map rest)
(partition-by first)
(drop-while (comp nil? ffirst))
(partition 2)
(map (fn [s] (let [[i & r] (keep identity (flatten s))]
[(Integer/parseInt i)
(-> (last r) .toLowerCase first (= \y))])))
(into {}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment