     [clojure.pprint :refer :all]))
 
 (defn create-proc-fn-vec-from-template
+  "Create a vector with n processing functions based on the two given \"template\" functions fn-1 and fn-n.
+   fn-1 is the function that will be put as first function in the resulting vector.
+   Subsequently, fn-n will be repeated n-1 times to fill the vector with n instances.
+   All occurrences of :_idx_ in the supplied functions will be replaced with the numerical index value of the corresponding function in the resulting vector."
   [fn-1 fn-n n]
   (loop [fns (prewalk-replace {:_idx_ 0} [fn-1])]
     (if (< (count fns) n)

          (map eval fns))))))

(defn combine-proc-fns
  [fn-vec start-idx end-idx]
  (fn [in out]
    (loop [fns (subvec fn-vec start-idx end-idx) o out]

    (rest fn-mapping)))

(defn calculate-distribution-mapping
  "Based on an input sequence, in-seq, and a vector of ratios, calculate a mapping such that the input sequence will be distributed according to the given ratios.
   The resulting mapping can be used, e.g., with combine-proc-fns-vec."
  ([in-seq ratios]
    (calculate-distribution-mapping in-seq ratios {}))
  ([in-seq ratios opts]
