I thought it would be fun to share my solutions so far for Advent of Code 2020, and invite anyone else to do the same!
I got this idea from the PureScript Discourse site, but I’m one of the rare folks out there who has significantly more PureScript experience than Haskell experience and I wanted to focus more on my Haskell skills right now. Hopefully we can all learn from each other by seeing how we solve some fun puzzles in different ways!
Thanks gilmi,
I pulled those from PureScript, honestly .
I might be missing something, but I think # and <#> are the flipped versions of $ and <$>, in the event that any expressions read easier “inside out” instead of “outside in” (when reading left-to-right).
I’d definitely love to see your solutions even if sloppy, because I bet you’ve got a lot of tricks that I’m not familiar with!
I knew there was a good reason to post my solutions on discourse. Learning things already. Thanks gilmi!
(I totally misread your original response and thought you just referred me to $ and <$>)
Well to my shame, I might be the only one still doing Advent of Code puzzles here towards the end of January, but I thought the puzzle for day 14 was able to use Haskell’s strengths in a pretty cool way. SPOILERS for anyone who’s even further behind than I am
In part 1 you apply a bit mask to some binary string. NP. In part 2, the bit mask is modified so that some bits get set to either 0 or 1, and you have to calculate all possible permutations. Oh okay, so I can just wrap each bit in a list, and then slap sequence in front, and I’ve got all the permutations.
I get the impression that in your “traditional” language, a change in requirements like that would mean an almost total rewrite, and in Haskell, it was a 5 minute modification, with no added lines of code (well, in my case 1 added line because I wanted an additional type annotation)