diff options
author | Hunky Jimpjorps <thechairman@thechairman.info> | 2022-12-03 10:21:15 -0500 |
---|---|---|
committer | Hunky Jimpjorps <thechairman@thechairman.info> | 2022-12-03 10:21:15 -0500 |
commit | e276854b56eff5508fb88e9a22563b3e80b18336 (patch) | |
tree | dd719a098027b87c3bfea989d38223b2538ef7a9 /2022/day-03 | |
parent | 4ce0a72964a42057b4c6f2bfaca5cfea56bd0eb4 (diff) | |
download | gleam_aoc-e276854b56eff5508fb88e9a22563b3e80b18336.tar.gz gleam_aoc-e276854b56eff5508fb88e9a22563b3e80b18336.zip |
day 03 small fix
Diffstat (limited to '2022/day-03')
-rw-r--r-- | 2022/day-03/day-03.ipynb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/2022/day-03/day-03.ipynb b/2022/day-03/day-03.ipynb index 4d5e5b4..27b8086 100644 --- a/2022/day-03/day-03.ipynb +++ b/2022/day-03/day-03.ipynb @@ -11,7 +11,7 @@ "\n", "**Part 2.** Each group of three elves is carrying exactly one item in common. What's the total priority value of those common items?\n", "\n", - "To ease the conversion between strings, lists and sets I bring in some utility functions from `relation`, and I also bring in one utility function for part 2 from `algorithms`. " + "To ease the conversion between strings, lists and sets I bring in some utility functions from `relation`. " ] }, { @@ -27,8 +27,7 @@ "(require racket\n", " advent-of-code\n", " threading\n", - " (only-in relation ->list ->set ->char)\n", - " (only-in algorithms chunks-of))\n" + " (only-in relation ->list ->set ->char))\n" ] }, { @@ -111,7 +110,7 @@ "source": [ "##### Part 2\n", "\n", - "Now we need to take three rucksacks at a time and find the common item they all share. The procedure is simpler than Part 1's, especially with the `chunks-of` function that automatically forms groups of three." + "Now we need to take three rucksacks at a time and find the common item they all share. The procedure is simpler than Part 1's, especially with the `in-slice` function that automatically forms groups of three." ] }, { @@ -138,7 +137,7 @@ } ], "source": [ - "(for/sum ([bags (in-list (chunks-of raw-inventory 3))])\n", + "(for/sum ([bags (in-slice 3 raw-inventory)])\n", " (~>> bags (map ->set) (apply set-intersect) set-first (hash-ref priority)))\n" ] } |