diff --git a/README.md b/README.md index 6274f19..76d3e5b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ gleam add iv@1 ```gleam import iv import gleam/int -import gleam/result // bubble sort, in my gleam? pub fn main() { @@ -50,14 +49,11 @@ fn bubble_sort_loop(array, index, max_index) { case iv.get(array, index - 1), iv.get(array, index) { // found 2 elements in the wrong order, swap them, then continue Ok(prev), Ok(curr) if prev > curr -> { - case + let array = array - |> iv.set(index, prev) - |> result.then(iv.set(_, index - 1, curr)) - { - Ok(array) -> bubble_sort_loop(array, index + 1, max_index) - Error(_) -> array - } + |> iv.try_set(index, prev) + |> iv.try_set(index - 1, curr) + bubble_sort_loop(array, index + 1, max_index) } // found 2 elements in the correct order, we can skip them! diff --git a/benchmarks.md b/benchmarks.md index 58620ee..bb18114 100644 --- a/benchmarks.md +++ b/benchmarks.md @@ -2,6 +2,8 @@ @import "https://unpkg.com/charts.css/dist/charts.min.css"; .benchmark { + margin-top: 1em; + .charts-css { --primary-axis-color: var(--bg-mono-1); --data-axes-color: var(--bg-mono-1); @@ -18,7 +20,7 @@ margin-bottom: 0.5em; } } - + table { min-width: 100%; } @@ -503,7 +505,7 @@ The goal of `iv` is to provide consistent, reliable performance across all kinds