                                 (:lines rs)))))
 
 (defn write-workspace-dlr-to-csv
-  [workspace file]
+  [workspace file functor]
   (write-date-lines-record-to-csv
     (merge-records-by-date
-      (get-workspace-records workspace))
+      (get-workspace-records workspace functor))
     file))
 
+
+(defn write-workspae-increment-dlr-to-csv
+  [workspace file]
+  (write-workspace-dlr-to-csv workspace file get-increment-lines))
 
 
 ;;; project's everyday progress

  {:project (:project record) :date (get-date record)})
  
(defn get-project-lines-records
  [workspace ]
  (let [dm (group-by get-project-and-date  
            (filter is-valid-record? (get-workspace-records workspace)))]
    (map #(->project-lines-record
           (:project %1)
           (:date %1)
           (get-modified-lines (get dm %1)))
         (keys dm))))
;;;
;;; project - loc
;;;
(defn write-workspace-plr-to-csv
  [workspace file]
  (with-open [*out* (java.io.FileWriter. file)]
    (doseq [rs (get-project-lines-records workspace)]
      (clojure.pprint/cl-format *out* 
                                "~s,~s,\"~d\"\r\n" 
                                (:project rs)
                                (:date rs)
                                (:lines rs)))))







    






          0 
          records))

;;; get line increments
(defn get-increment-lines
  [records]
  (reduce #(+ %1 (- (:added-lines %2) (:deleted-lines %2))) 
          0 
          records))


(defrecord date-lines-record
  [date lines])
;;;
;;; merge records by date
;;;
(defn merge-records-by-date
  [records functor]
  (let [dm (group-by get-date (filter (partial is-commit-in-date? "*") 
                                      (filter is-valid-record? records)))]
    (map #(->date-lines-record
             %1 
             (functor (get dm %1))) 
         (keys dm))))

;;;
