Advent of Code 2024 - Day 8

Поділитися
Вставка
  • Опубліковано 16 гру 2024

КОМЕНТАРІ • 3

  • @DavidLindes
    @DavidLindes 8 днів тому +1

    27:37 - oh wow. I... just looked it up, and I kinda wish I hadn't. Yeah, that's a truly bass-ackwards way to do things.
    ("but 1234567!" ... yeah, no. Please please no. 😭 I think that might even be enough to make go a permanent no-go for me.)
    33:51 (33:30 for context) - yeah, I don't plan to switch from non-live watching on UA-cam, but I agree: purple is the color of awesome!
    2:55:51 - oh yeah, you were going to rework debug for 2d arrays... but I guess you got sidetracked. Something to return to??
    3:20:06 - huh. "Loops shouldn't extend scope"... [note: sharing thoughts, but I actually change my mind; leaving it as I typed it just so you can see my thought process -- on the off chance you're interested] I mean, it's your language, so if that's what you want to do, yes, and maybe I'm not sure the precise meaning you have in your mind of "extend", and so I'm arguing against something you're not trying to say, but to me, in a language generally, what I'm used to is that a new scope would be overlayed by the loop creation, but with visibility back out to the prior scope... so, name collisions (as you detected here) might still be a thing (though with "let", I'm used to that being allowed to mask the outer scope, e.g. in lisp -- but with other specifiers and/or in other languages, not necessarily so), but either way, the thing you're rocking should have visibility out to its creation before the loop started, and thus modify that mutable thing, instead of creating a new one in the loop scope (which would not be visible once exiting the loop -- and I'd expect that if a different name was used). Hopefully that makes some kind of sense, even if you disagree.
    That said, python3 seems to not extend scope... ruby does, though it could be argued that this is because we're creating a new function here (a session in irb follows):
    irb(main):005:0> x = "look at me!"
    => "look at me!"
    irb(main):006:0> (0..10).map{|x| x}
    => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    irb(main):007:0> x
    => "look at me!"
    Oh, yeah, actually, I think I'm coming around to you're right, because if I try a different loop construct:
    irb(main):012:1* for x in (0..2)
    irb(main):013:1* puts x
    irb(main):014:0> end
    0
    1
    2
    => 0..2
    irb(main):015:0> x
    => 2
    So, yeah, I guess loops shouldn't extend scope! Who knew? :D
    Anyway, super interesting to watch your process on all this. Thanks for doing these. :)

  • @suntracker844
    @suntracker844 8 днів тому

    Dylan rocks like Ozzy but in plain text