Avatar
@swift-main func withMemoryCSVWriter<each T: LosslessStringConvertible>( headers: repeat (String, (each T).Type), task: (_ emit: (_ row: repeat each T) throws -> () ) throws -> () ) throws { var arrayHeaders: [String] = [] repeat arrayHeaders.append((each headers).0) print(arrayHeaders) try task { (_ row: repeat each T) in var arrayRow: [String] = [] repeat arrayRow.append((each row).description) print(arrayRow) } } try withMemoryCSVWriter(headers: ("aaa", Int.self), ("iii", String.self) ) { (emit: (Int, String) throws -> ()) in try emit(1, "hello") }