Skip to content

Commit

Permalink
[gleam][book-store] rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
joaofnds committed Jul 27, 2024
1 parent 3d8496e commit 25fab76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gleam/book-store/src/book_store.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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
}
Expand Down

0 comments on commit 25fab76

Please sign in to comment.