Skip to content

Commit

Permalink
Remove another helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Dec 2, 2024
1 parent bbbc8d8 commit df9ad30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/aoc_2024/day_2.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn pt_2(input: List(List(Int))) {
input
|> list.count(fn(line) {
line
|> extra.selections
|> list.any(fn(selection) { is_ok(selection.1) })
|> list.combinations(list.length(line) - 1)
|> list.any(is_ok)
})
}
5 changes: 0 additions & 5 deletions src/extra.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ pub fn remove_at(xs: List(a), at i: Int) -> List(a) {
list.append(list.take(xs, i), list.drop(xs, i + 1))
}

/// selections([5,10,2]) -> [ #(5,[10,2]), #(10,[5,2]), #(2,[5,10]) ]
pub fn selections(xs: List(a)) -> List(#(a, List(a))) {
list.index_map(xs, fn(x, i) { #(x, remove_at(xs, i)) })
}

pub fn yolo_int(x: String) -> Int {
let assert Ok(n) = int.parse(x)
n
Expand Down

0 comments on commit df9ad30

Please sign in to comment.