          result#))))
 
 (defmacro fileset-reduce
+  "Given a fileset, a function get-files that selects files from the fileset,
+  and a number of reducing functions, composes the reductions. The result of
+  the previous reduction and the result of get-files applied to it are passed
+  through to the next reducing function."
   [fileset get-files & reducers]
   (if-not (seq reducers)
     fileset
-    (let [each-reducer (fn [r]
-                         [`((juxt identity ~get-files))
-                          `(apply reduce ~r)])]
+    (let [each-reducer #(vector `((juxt identity ~get-files)) `(apply reduce ~%))]
       `(->> ~fileset ~@(mapcat each-reducer reducers)))))
 
 ;; Task Configuration Macros ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  [tmpfile]
  (tmpd/time tmpfile))

(defn fileset-diff
  "Returns a new fileset containing files that were added or modified. Removed
  files are not considered. The optional props arguments can be any of :time,
  :hash, or both, specifying whether to consider changes to last modified time
  or content md5 hash of the files (the default is both)."
  [before after & props]
  (apply tmpd/diff before after props))

(defn fileset-added
  "Returns a new fileset containing only files that were added."
  [before after & props]
  (apply tmpd/added before after props))

(defn fileset-removed
  "Returns a new fileset containing only files that were removed."
  [before after & props]
  (apply tmpd/removed before after props))

(defn fileset-changed
  "Returns a new fileset containing only files that were changed."
  [before after & props]
  (apply tmpd/changed before after props))

;; TmpFileSet API

(defn user-dirs
  "Get a list of directories containing files that originated in the project's

  "FIXME: document"
  [fileset tmpfiles]
  (tmpd/add-tmp fileset (get-add-dir fileset #{:resource}) tmpfiles))

(defn fileset-diff
  "Returns a new fileset containing files that were added or modified. Removed
  files are not considered. The optional props arguments can be any of :time,
  :hash, or both, specifying whether to consider changes to last modified time
  or content md5 hash of the files (the default is both)."
  [before after & props]
  (apply tmpd/diff before after props))

(defn fileset-added
  "Returns a new fileset containing only files that were added."
  [before after & props]
  (apply tmpd/added before after props))

(defn fileset-removed
  "Returns a new fileset containing only files that were removed."
  [before after & props]
  (apply tmpd/removed before after props))

(defn fileset-changed
  "Returns a new fileset containing only files that were changed."
  [before after & props]
  (apply tmpd/changed before after props))

;; Tempdir helpers

