Skip to content

Commit 5064cc7

Browse files
author
Matthew Judy
committed
Update previous challenge to use async lines API.
1 parent aac74d1 commit 5064cc7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/2022/08/TreetopTreeHouse.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ extension TreetopTreeHouse
189189

190190
mutating func run() async throws
191191
{
192-
let input = FileHandle.standardInput.bytes
193-
let rows : [[Int]] = try await input.lines.reduce(into: [[Int]]()) { $0.append($1.compactMap { Int(String($0))! }) }
194-
let columns : [[Int]] = rows[0].enumerated().map { rows[column: $0.0] }
192+
let input : AsyncLineSequence = FileHandle.standardInput.bytes.lines
193+
let rows : [[Int]] = try await input.reduce(into: [[Int]]()) { $0.append($1.integers) }
194+
let columns : [[Int]] = rows[0].enumerated().map { rows[column: $0.0] }
195195

196196
switch self.mode
197197
{

0 commit comments

Comments
 (0)