Advent of Code 2024 in BQN Day 4!

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ธ.ค. 2024

ความคิดเห็น • 6

  • @jakubgaecki5629
    @jakubgaecki5629 2 วันที่ผ่านมา +1

    Alternative (simpler?) solution to checking the X pattern in part 2: extract the diagonals into a 2x3 matrix, laminate it with its reverse, then check if exactly 2 rows are equal to 'MAS'.

  • @davidzwitser
    @davidzwitser 2 วันที่ผ่านมา +1

    Super cool 😁 fun to see how differently this can be approached. I was also inspired by dzaima's solution, I have a video of mine on my channel if that's interesting

  • @oantolin
    @oantolin 22 ชั่วโมงที่ผ่านมา

    The fact that the windows function in BQN signals an error if the list is shorter than the length of the list is a clear design bug. The definition should be "returns the list of all k element contiguous sublists", which of course implies it returns an empty list if k is bigger than the length. Instead the current definition seems to be "returns the list of all k element contiguous sublists if there are any and raises an error otherwise". The fact that the definition is given by cases is a bad sign, if you ask me.
    In fact, I'd go as far as suggesting that of the current definition of windows is kept as is, the find function should also error if the search string is longer than the string you search in, you know, for consistency.

  • @boredstudent9468
    @boredstudent9468 3 วันที่ผ่านมา

    Where can I find more about that diagonals function, while not bqn I tried solving it declaratively but the diagonals broke me.

    • @code_report
      @code_report  3 วันที่ผ่านมา

      Just wrote this up, hope it helps: mlochbaum.github.io/BQN/try.html#code=TG9nIOKGkCB74oCiU2hvdyDwnZWo4oC/8J2VqX0KCiJtIiBMb2cgbSDihpAgM+KAvzPipYrihpU5CkQg4oaQICgr4oycwrTihpXCqOKImOKJoiniirjiipQKCiMgU3RlcCBieSBTdGVwCiJyYW5nZSBvZiBlYWNoIGRpbWVuc3Rpb24iIExvZyDihpXCqOKJoiBtCiJvdXRlciBwcm9kIHN1bSIgTG9nICgr4oycwrTihpXCqOKImOKJoiltCiJncm91cCIg4oC/ICgoK+KMnMK04oaVwqjiiJjiiaIp4oq44oqUIG0p