From 25fab76a48f19bd109c9a096beb26897780b4511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Fernandes?= Date: Sat, 27 Jul 2024 18:14:46 -0300 Subject: [PATCH] [gleam][book-store] rename variables --- gleam/book-store/src/book_store.gleam | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gleam/book-store/src/book_store.gleam b/gleam/book-store/src/book_store.gleam index 5098752..eb919f6 100644 --- a/gleam/book-store/src/book_store.gleam +++ b/gleam/book-store/src/book_store.gleam @@ -13,7 +13,8 @@ pub fn lowest_price(books: List(Int)) -> Float { fn price(books: List(Int), sum: Float) -> Float { let books = - list.filter(books, fn(b) { b > 0 }) + books + |> list.filter(fn(n) { n > 0 }) |> list.sort(int.compare) |> list.map(int.subtract(_, 1)) @@ -24,8 +25,8 @@ fn price(books: List(Int), sum: Float) -> Float { [_, _, _, _] -> price(books, sum +. 4.0 *. 640.0) [a, ..rest] -> float.min( + price(books, sum +. 5.0 *. 600.0), price([a + 1, ..rest], sum +. 4.0 *. 640.0), - price([a, ..rest], sum +. 5.0 *. 600.0), ) _ -> sum }