     func serialize(with context: Graph) -> String
 }
 
-func serializeStatements(statements: [Statement], with context: Graph) -> String {
-    return statements.map({ $0.serialize(with: context) }).joinWithSeparator("; ")
+extension SequenceType where Generator.Element == Statement {
+    func serialize(with context: Graph) -> String {
+        return self.map({ $0.serialize(with: context) }).joinWithSeparator("; ")
+    }
 }
 
 struct Graph {


extension Subgraph: Statement {
    func serialize(with context: Graph) -> String {
        return "subgraph \(identifier) { \(serializeStatements(statements, with: context)) }"
    }
}


    }

    func serialize() -> String {
        return "\(type.rawValue) \(name) { \(statements.serialize(with: self)) }".removingRepeatedWhitespace()
    }
}

