Skip to content

Commit

Permalink
update to gladvent v1
Browse files Browse the repository at this point in the history
  • Loading branch information
TanklesXL committed Aug 9, 2024
1 parent a747724 commit 8d543fa
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ jobs:
test:
uses: TanklesXL/gleam_actions/.github/workflows/test.yaml@main
with:
gleam_version: 1.1.0
gleam_version: 1.4.1
test_node: false
test_erlang: true
test_erlang: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.ez
build
erl_crash.dump
input/*/*.example.txt
45 changes: 40 additions & 5 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "advent_of_code"
version = "0.1.0"
gleam = "~> 1.0"
gleam = "~> 1.4"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
Expand All @@ -11,9 +11,44 @@ gleam = "~> 1.0"
# links = [{ title = "Website", href = "https://gleam.run" }]

[dependencies]
gleam_stdlib = "~> 0.36"
gleam_json = "~> 1.0"
gleam_stdlib = "~> 0.39"
gleam_json = "~> 2.0"

[dev-dependencies]
gleeunit = "~> 1.0"
gladvent = "~> 0.7"
gladvent = "~> 1.0"
gleeunit = ">= 1.2.0 and < 2.0.0"

[gladvent.2020]
1 = { pt_1 = 972576, pt_2 = 199300880 }
2 = { pt_1 = 546, pt_2 = 275 }
3 = { pt_1 = 265, pt_2 = 3154761400 }
4 = { pt_1 = 233, pt_2 = 111 }
5 = { pt_1 = 801, pt_2 = 597 }
6 = { pt_1 = 6457, pt_2 = 3260 }
7 = { pt_1 = 139, pt_2 = 58175 }
8 = { pt_1 = 1859, pt_2 = 1235 }
9 = { pt_1 = 393911906, pt_2 = 59341885 }
10 = { pt_1 = 1656, pt_2 = 56693912375296 }
11 = { pt_1 = 2238, pt_2 = 2013 }
13 = { pt_1 = 2092, pt_2 = 702970661767766 }
14 = { pt_1 = 9628746976360, pt_2 = 4574598714592 }
15 = { pt_1 = 959, pt_2 = 116590 }
16 = { pt_1 = 23115, pt_2 = 239727793813 }
17 = { pt_1 = 252, pt_2 = 2160 }

[gladvent.2021]
1 = { pt_1 = 1624, pt_2 = 1653 }
2 = { pt_1 = 2117664, pt_2 = 2073416724 }
3 = { pt_1 = 2498354, pt_2 = 3277956 }

[gladvent.2022]
1 = { pt_1 = 67450, pt_2 = 199357 }
2 = { pt_1 = 15691, pt_2 = 12989 }
3 = { pt_1 = 7824, pt_2 = 2798 }
4 = { pt_1 = 485, pt_2 = 857 }
5 = { pt_1 = "RTGWZTHLD", pt_2 = "STHGRZZFR" }
6 = { pt_1 = 1480, pt_2 = 2746 }
7 = { pt_1 = 1391690, pt_2 = 5469168 }

[gladvent.2023]
1 = { pt_1 = 55123, pt_2 = 55260 }
28 changes: 14 additions & 14 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@

packages = [
{ name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" },
{ name = "decode", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "decode", source = "hex", outer_checksum = "965F517F67B8C172CA27A5C8E34C73733139E8C9E64736181B8C3179281F9793" },
{ name = "filepath", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "EFB6FF65C98B2A16378ABC3EE2B14124168C0CE5201553DE652E2644DCFDB594" },
{ name = "gladvent", version = "0.7.3", build_tools = ["gleam"], requirements = ["argv", "filepath", "gleam_erlang", "gleam_json", "gleam_otp", "gleam_package_interface", "gleam_stdlib", "glint", "parallel_map", "shellout", "simplifile", "snag", "spinner", "tom"], otp_app = "gladvent", source = "hex", outer_checksum = "59D93FD759427BCE8EE9828C0B62A3CD18362225F948C9789D334DCEAD621358" },
{ name = "gladvent", version = "1.0.1", build_tools = ["gleam"], requirements = ["argv", "decode", "filepath", "gleam_erlang", "gleam_json", "gleam_otp", "gleam_package_interface", "gleam_stdlib", "glint", "parallel_map", "shellout", "simplifile", "snag", "spinner", "tom"], otp_app = "gladvent", source = "hex", outer_checksum = "694BCDE5D6EB0C4DFF4633A0D0921D1A7FBEDDD723E3089530C69378AF314116" },
{ name = "gleam_community_ansi", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "FE79E08BF97009729259B6357EC058315B6FBB916FAD1C2FF9355115FEB0D3A4" },
{ name = "gleam_community_colour", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "795964217EBEDB3DA656F5EB8F67D7AD22872EB95182042D3E7AFEF32D3FD2FE" },
{ name = "gleam_community_colour", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "A49A5E3AE8B637A5ACBA80ECB9B1AFE89FD3D5351FF6410A42B84F666D40D7D5" },
{ name = "gleam_erlang", version = "0.25.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "054D571A7092D2A9727B3E5D183B7507DAB0DA41556EC9133606F09C15497373" },
{ name = "gleam_json", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib", "thoas"], otp_app = "gleam_json", source = "hex", outer_checksum = "9063D14D25406326C0255BDA0021541E797D8A7A12573D849462CAFED459F6EB" },
{ name = "gleam_json", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "CB10B0E7BF44282FB25162F1A24C1A025F6B93E777CCF238C4017E4EEF2CDE97" },
{ name = "gleam_otp", version = "0.10.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "0B04FE915ACECE539B317F9652CAADBBC0F000184D586AAAF2D94C100945D72B" },
{ name = "gleam_package_interface", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_package_interface", source = "hex", outer_checksum = "52A721BCA972C8099BB881195D821AAA64B9F2655BECC102165D5A1097731F01" },
{ name = "gleam_stdlib", version = "0.38.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "663CF11861179AF415A625307447775C09404E752FF99A24E2057C835319F1BE" },
{ name = "gleam_package_interface", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_package_interface", source = "hex", outer_checksum = "CF3BFC5D0997750D9550D8D73A90F4B8D71C6C081B20ED4E70FFBE1E99AFC3C2" },
{ name = "gleam_stdlib", version = "0.39.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "2D7DE885A6EA7F1D5015D1698920C9BAF7241102836CE0C3837A4F160128A9C4" },
{ name = "glearray", version = "0.2.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glearray", source = "hex", outer_checksum = "9C207E05F38D724F464FA921378DB3ABC2B0A2F5821116D8BC8B2CACC68930D5" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
{ name = "glint", version = "1.0.0-rc2", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "FD5C47CE237CA67121F3946ADE7C630750BB67F5E8A4717D2DF5B5EE758CCFDB" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "glint", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "369C8A289017F73581D6B9FE2F5748169EB6FA021FFAA34FA7A49EE2094C73B3" },
{ name = "parallel_map", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "parallel_map", source = "hex", outer_checksum = "653714A9FD63EACD1A9D0A6582A972B0EC109AE275CDDD2E99CFC3DFAFAB9225" },
{ name = "repeatedly", version = "2.1.1", build_tools = ["gleam"], requirements = [], otp_app = "repeatedly", source = "hex", outer_checksum = "38808C3EC382B0CD981336D5879C24ECB37FCB9C1D1BD128F7A80B0F74404D79" },
{ name = "shellout", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "E2FCD18957F0E9F67E1F497FC9FF57393392F8A9BAEAEA4779541DE7A68DD7E0" },
{ name = "simplifile", version = "1.7.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "1D5DFA3A2F9319EC85825F6ED88B8E449F381B0D55A62F5E61424E748E7DDEB0" },
{ name = "simplifile", version = "2.0.1", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "5FFEBD0CAB39BDD343C3E1CCA6438B2848847DC170BA2386DF9D7064F34DF000" },
{ name = "snag", version = "0.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "54D32E16E33655346AA3E66CBA7E191DE0A8793D2C05284E3EFB90AD2CE92BCC" },
{ name = "spinner", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_erlang", "gleam_stdlib", "glearray", "repeatedly"], otp_app = "spinner", source = "hex", outer_checksum = "200BA3D4A04D468898E63C0D316E23F526E02514BC46454091975CB5BAE41E8F" },
{ name = "thoas", version = "1.2.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "E38697EDFFD6E91BD12CEA41B155115282630075C2A727E7A6B2947F5408B86A" },
{ name = "tom", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "tom", source = "hex", outer_checksum = "A5364613E3DBF77F38EFF81DA9F99324086D029EC2B2D44348762FBE38602311" },
{ name = "tom", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "tom", source = "hex", outer_checksum = "9EECB60150E834A07238BD5C7DF1FF07F7D4C5862BB8A773923D1981C7875FB0" },
]

[requirements]
gladvent = { version = "~> 0.7" }
gleam_json = { version = "~> 1.0" }
gleam_stdlib = { version = "~> 0.36" }
gleeunit = { version = "~> 1.0" }
gladvent = { version = "~> 1.0" }
gleam_json = { version = "~> 2.0" }
gleam_stdlib = { version = "~> 0.39" }
gleeunit = { version = ">= 1.2.0 and < 2.0.0" }
2 changes: 1 addition & 1 deletion src/aoc_2020/day_15.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ fn speak(acc: #(Int, Map(Int, Spoken)), step: Int) -> #(Int, Map(Int, Spoken)) {
}
}

#(to_update, map.update(when_inserted, to_update, updater))
#(to_update, map.upsert(when_inserted, to_update, updater))
}
2 changes: 1 addition & 1 deletion src/aoc_2020/day_17.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ fn expand_world(space: Space, neighbours: fn(Pos) -> Iterator(Pos)) -> Space {
|> iterator.to_list()
|> set.from_list()
|> set.fold(space, fn(acc, pos) {
map.update(acc, pos, option.unwrap(_, Inactive))
map.upsert(acc, pos, option.unwrap(_, Inactive))
})
}

Expand Down
7 changes: 2 additions & 5 deletions src/aoc_2020/day_3.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ pub fn pt_1(input: Map(Int, Map(Int, String))) -> Int {
}

const pt_2_slopes = [
Slope(right: 1, down: 1),
Slope(right: 3, down: 1),
Slope(right: 5, down: 1),
Slope(right: 7, down: 1),
Slope(right: 1, down: 2),
Slope(right: 1, down: 1), Slope(right: 3, down: 1), Slope(right: 5, down: 1),
Slope(right: 7, down: 1), Slope(right: 1, down: 2),
]

pub fn pt_2(input: Map(Int, Map(Int, String))) -> Int {
Expand Down
2 changes: 1 addition & 1 deletion src/aoc_2020/day_8.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn permutations_with_swaps(ops: Map(Int, Op)) -> List(Map(Int, Op)) {
ops
|> map.filter(filter_only_jmp_and_nop)
|> map.keys()
|> list.map(map.update(ops, _, swap_jmp_and_nop))
|> list.map(map.upsert(ops, _, swap_jmp_and_nop))
}

fn filter_only_jmp_and_nop(_name: Int, op: Op) -> Bool {
Expand Down
4 changes: 2 additions & 2 deletions src/aoc_2022/day_5.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn pt_1(input: #(Map(Int, List(String)), Iterator(Move))) {
use stacks <- repeatedly(with: stacks, num: move.count)
let assert Ok([val, ..rest]) = map.get(stacks, move.from)
let stacks = map.insert(stacks, move.from, rest)
use stack <- map.update(stacks, move.to)
use stack <- map.upsert(stacks, move.to)
let assert Some(stack) = stack
[val, ..stack]
}
Expand All @@ -86,7 +86,7 @@ pub fn pt_2(input: #(Map(Int, List(String)), Iterator(Move))) {
|> map.get(move.from)
|> result.map(list.split(_, at: move.count))
let stacks = map.insert(stacks, move.from, rest)
use stack <- map.update(stacks, move.to)
use stack <- map.upsert(stacks, move.to)
let assert Some(stack) = stack
list.append(top, stack)
}
2 changes: 1 addition & 1 deletion src/aoc_2022/day_7.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn dir_sizes(l: List(#(List(String), List(FS)))) {
// for each new path, calculate the total size, checking the size of any subdirs
use tree, elem <- list.fold(sorted, map.new())
use tree, fs <- list.fold(elem.1, tree)
use size <- map.update(tree, elem.0)
use size <- map.upsert(tree, elem.0)
let cum_size = option.unwrap(size, 0)
cum_size
+ case fs {
Expand Down
23 changes: 0 additions & 23 deletions test/aoc_2023/day_1_test.gleam

This file was deleted.

0 comments on commit 8d543fa

Please sign in to comment.