   )
 )
 
-"Defines the map of functions which can be used"
-(def functions 
-  {:cnt (fn [tasks] (count tasks))}
-)
-
 (defn apply-filter [filter-conditions tasks]
 "
 Takes an example of the task which should be matched and 

    tasks)
)

(defn apply-function [function tasks]
  ((function functions) tasks)
)

(defn generate-report [descriptor tasks]

The tasks are one timeframe output from the reduce-tasks

Example input (aka descriptor)
(def d [{:function :cnt :filter {:workflowitem-id 10} :children [{:function :cnt :filter {:workflowitem-id 10}}]}])

Example input (aka list of tasks)
(def t [{:workflowitem-id 10} {:workflowitem-id 20}])

Example output
[1 [1]]
"
  (loop [res [] desc descriptor]
    (if (= (count desc) 0)
      res
      (let [filtered-tasks (apply-filter (:filter (first desc)) tasks) function (:function (first desc))]
           (if (:children (first desc))
             (recur (conj res (apply-function function filtered-tasks) (generate-report (:children (first desc)) filtered-tasks)) (rest desc))
             (recur (conj res (apply-function function filtered-tasks)) (rest desc))
             )           
       )
