Skip to content

Instantly share code, notes, and snippets.

@rrees
Created May 28, 2012 16:19
Show Gist options
  • Save rrees/2819932 to your computer and use it in GitHub Desktop.
Save rrees/2819932 to your computer and use it in GitHub Desktop.
Event reducer example
(def example-story-events [
{
:title "Funding cut again"
:tags [:science]
:author ["Chuck Newton"]
}
{
:tags [:politics]
}
{
:title "A difficult tightrope to cross"
}
])
(defn article-reducer [acc event]
(into acc
(for [[k, v] event]
(if (vector? v)
[k (concat (k event) (k acc) )]
[k v]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment