Skip to content

Commit 505ed87

Browse files
committed
Wrap long lines for readability
Refactor
1 parent adc6bd4 commit 505ed87

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/str/internal/core.gleam

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1340,7 +1340,9 @@ pub fn distance(a: String, b: String) -> Int {
13401340
/// Uses a single row for space efficiency.
13411341
fn levenshtein(a: List(String), b: List(String), _a_len: Int, b_len: Int) -> Int {
13421342
// Initialize first row: [0, 1, 2, ..., b_len]
1343-
let initial_row = int.range(from: 0, to: b_len + 1, with: [], run: list.prepend) |> list.reverse
1343+
let initial_row =
1344+
int.range(from: 0, to: b_len + 1, with: [], run: list.prepend)
1345+
|> list.reverse
13441346

13451347
// Process each character of a
13461348
let final_row =

test/str_core_test.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ pub fn grapple_len_behavior_test() {
407407
assert str.length("👨‍👩‍👧‍👦") == 1
408408

409409
// Stress: long ASCII string should return its length
410-
let long = int.range(from: 1, to: 1001, with: "", run: fn(acc, _) { acc <> "x" })
410+
let long =
411+
int.range(from: 1, to: 1001, with: "", run: fn(acc, _) { acc <> "x" })
411412
assert str.length(long) == 1000
412413
}
413414

test/str_length_edge_cases_test.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub fn length_edge_cases_test() {
1414
assert str.length("👩‍❤️‍👨") == 1
1515

1616
// Long string sanity: 500 'x' characters
17-
let long = int.range(from: 1, to: 501, with: "", run: fn(acc, _) { acc <> "x" })
17+
let long =
18+
int.range(from: 1, to: 501, with: "", run: fn(acc, _) { acc <> "x" })
1819
assert str.length(long) == 500
1920
}

test/str_length_more_test.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub fn length_more_test() {
3030
assert str.length("𐐷") == 1
3131

3232
// Long ASCII string
33-
let long = int.range(from: 1, to: 101, with: "", run: fn(acc, _) { acc <> "x" })
33+
let long =
34+
int.range(from: 1, to: 101, with: "", run: fn(acc, _) { acc <> "x" })
3435
assert str.length(long) == 100
3536
}

0 commit comments

Comments
 (0)