Skip to content

Instantly share code, notes, and snippets.

@weavejester
Created May 29, 2013 12:37
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 weavejester/dccd00f8be0cf7c4dfe9 to your computer and use it in GitHub Desktop.
Save weavejester/dccd00f8be0cf7c4dfe9 to your computer and use it in GitHub Desktop.
(defn count-stream [stream]
(r/reduce (fn [x _] (inc x)) 0 stream))
(defn average [stream]
(behavior (/ @(r/reduce + 0 stream) @(count-stream stream))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment