1. 20
  1.  

  2. 5

    I was a little disappointed by the fact that it seems like there is easy, built-in way of [parsing input].

    Spoken like a true Haskeller ;)

    1. 5

      I actually used infinite lists in my Python solutions this year. I can’t remember which one, but it was essentially “find the smallest number with some property”, which you can do like

      next(i for i in itertools.count(1) if has_property(i))
      

      I once gave a whole talk that was (in essence) about using Haskell-style infinite lists in Python:

      https://docs.google.com/presentation/d/1eI60SL3UxtWfr9ktrv48-pcIkk4S7JiDmeXGCyyGhCs/edit?usp=sharing

      Not to be all self-promoting, but it’s a fun talk.

      Anyway, good on you for doing it all in Haskell, I always aspire to try that, and then I always end up just doing it in Python.

      1. 2

        I think the trick is do it with something you know well to get a feel for solving the problem, then try it in X.

        Generators are great though - I used Racket’s generator support to implement the infinite spiral of day 3. I should look into doing it using the lazy language to just use regular list operations but lazily. I tried using streams but the performance was much worse - the garbage collector got overwhelmed which probably means I’m not using them correctly.