Hi, I’m Amy.

✨ New 🏳️‍⚧️ improved ♀️ version 👩‍❤️‍👩 out 🏳️‍🌈 now! 🎊

I live in Japan. Talk to me about Haskell, Scheme, and Linux.

日本語も通じます。

  • 3 Posts
  • 147 Comments
Joined 2 years ago
cake
Cake day: June 12th, 2023

help-circle















  • I agree with 15: I solved it pretty quickly and I like my solution, but what makes me really happy is that I’m pretty sure I couldn’t have solved it a few years ago.

    Also day 11 (Plutonian pebbles): it’s such a simple problem, and part two is a perfect example of how and why to use dynamic programming. I’ve been encouraging everyone to try it.





  • Haskell

    A total inability to write code correctly today slowed me down a bit, but I got there in the end. Merry Christmas, everyone <3

    import Data.Either
    import Data.List
    import Data.List.Split
    
    readInput = partitionEithers . map readEntry . splitOn [""] . lines
      where
        readEntry ls =
          (if head (head ls) == '#' then Left else Right)
            . map (length . head . group)
            $ transpose ls
    
    main = do
      (locks, keys) <- readInput <$> readFile "input25"
      print . length $ filter (and . uncurry (zipWith (<=))) ((,) <$> locks <*> keys)