This one’s important - Refactoring to Functional Kotlin

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

КОМЕНТАРІ • 10

  • @kyay10
    @kyay10 4 місяці тому +3

    Technically the `i is being mutated` at 9:26 is an implementation detail. Kotlin could've implemented for loops over Int ranges as a tail-recursive function and instead of mutating `i`, it would instead call itself but passing a new value of i. Of course, that's inefficient (unless you use the `tailrec` modifier, which will convert it to a loop with mutation anyways)

    • @PairingWithDuncan
      @PairingWithDuncan  4 місяці тому +3

      Indeed, but at this point I’m trying to point out actions when we have them, and for loops are pretty actiony. I suppose more so in C where we have to write our own ;I++

  • @codeRight
    @codeRight 4 місяці тому +3

    Good stuff! I'm trying to learn more about sequences and this has given a lot to chew on. Love your use of the IDE to make changes quickly and safely.

  • @21Kikoshi
    @21Kikoshi 4 місяці тому +1

    I wish your content didnt use a white background for your IDE. It hurts my eyes to watch it. It if was in dark mode I would watch but sorry I just cant.

    • @PairingWithDuncan
      @PairingWithDuncan  4 місяці тому +1

      The problem is that, with old eyes, I can’t see dark mode!

    • @21Kikoshi
      @21Kikoshi 4 місяці тому

      @@PairingWithDuncan Haha all good!

    • @razvanfilip3735
      @razvanfilip3735 4 місяці тому +1

      Light theme feels so comfy for me, like reading a book

    • @PairingWithDuncan
      @PairingWithDuncan  4 місяці тому +2

      @razvanfilip3735 Curse you - I’ve literally just started recording this week in dark mode to see how it goes!

    • @21Kikoshi
      @21Kikoshi 4 місяці тому

      @@PairingWithDuncan haha goodluck!