 			     (re-matches #"^[^,]+,[^,]+$" (.readLine rdr))
 			     (catch Exception _))))
 
-(defmethod read-context :csv [file]
+(defmethod read-context :csv
+  [file]
   (let [in (reader file)]
     (loop [inz #{}]
       (let [line (.readLine in)]

	  (let [[_ g m] (re-matches #"^([^,])+,([^,])+$" line)]
	    (recur (conj inz [g m]))))))))

(defmethod write-context :csv [_ ctx file]
  (if (some (fn [x] (and (string? x) (some #(= \, %) x))) (concat (objects ctx) (attributes ctx)))
    (illegal-argument "Cannot export to :csv format, object or attribute names contain \",\"."))
  (with-out-writer file
    (doseq [[g m] (incidence ctx)]
      (println (str g "," m)))))

;;; TODO


;; csc
;; csx?
;; tuples

;;;

