Rust's iterators are more interesting than they look

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

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

  • @darklajid
    @darklajid ปีที่แล้ว +24

    Wait. Am I losing my mind or are you saying "integer" instead of "iterator" the first two times in the video/in the first 10 seconds?

    • @JamesRouzier
      @JamesRouzier ปีที่แล้ว +3

      He did say integer

    • @timClicks
      @timClicks  ปีที่แล้ว +7

      Probably. My brain is a bit weird sometimes 😅

    • @JamesRouzier
      @JamesRouzier ปีที่แล้ว +9

      @@timClicks no problem it is a good way to increase engagement.
      Sprinkle little mistakes in your videos.
      Then people will point then out in the comments.

  • @pbnjdev
    @pbnjdev ปีที่แล้ว +7

    As usual, Tim, thank you for the explainer and the great content.
    I had a question and a correction:
    1. At 13:37 - any reason why `Option` should not be re-written more concisely as `Option`? The compiler doesn't seem to mind/complain.
    2. At 13:51 - there is an error - `if some.remaining_iterations` , but it should be `if self.remaining_iterations`

    • @timClicks
      @timClicks  ปีที่แล้ว +8

      Thanks for those comments Peter. I think that your intuition is correct. You may have noticed that I hesitated at 13:37 because I wondered that myself. Either is fine.
      Thank you for notifying me of the typo at 13:51 - this proves that I shouldn't use slide show software as an IDE.

  • @michaelmueller9635
    @michaelmueller9635 ปีที่แล้ว +3

    When I was going into Rust, it first really confused me, how obsessed Rust with iterators is. It's almost impossible to loop collections by indices and do some weird stuff by indices hopping. If you are coming from C++, this should be easy.
    But one big advantage in Rust: Because the iterators are so standardized and all over the place, you can swap the underlying data structure really easily (as long as the iterator-trait is implemented).
    So you don't have to mind for the perfect data structure at the beginning by casting the data structure into the design of your program. You can swap the data structure later on (by benchmark testing or if the requirements for the project are changing).

    • @MarcusBrito
      @MarcusBrito ปีที่แล้ว +1

      Iterator compose _very_ nicely and through composition you can perform the stuff you mentioned here. For example, `Iterator::enumerate()` transforms an iterator's output into a tuple of (index, element) - probably what you need to loop a collection by index, and `Iterator::step_by()` gives you index hopping. If the standard iterator trait is missing a transformation you need, chances are, you'll find it in the `itertools` crate.

  • @pixelsandpointers
    @pixelsandpointers ปีที่แล้ว +4

    I am a fan of the slides' design. Had to say that, content as always very nice :)

  • @philippschulz7404
    @philippschulz7404 7 หลายเดือนก่อน

    Hey Tim!
    Thanks for this great educational resource. 🤓
    I'm currently learning Rust and this video perfectly closes the gap between the knowledge I've gained from the Rust book and the questions I've personally had about iterators. One thing I find difficult as a learner is understanding how to figure out which iterator methods can be chained and which cannot.

  • @pramodjingade6581
    @pramodjingade6581 ปีที่แล้ว

    @timClicks: 💡Thank you for this excellent video..may I ask which tool you use for the presentation ? Very well presented !!

    • @timClicks
      @timClicks  ปีที่แล้ว +1

      Google Slides and too much time tweaking animations :)

    • @pramodjingade6581
      @pramodjingade6581 ปีที่แล้ว

      @@timClicks thank you for replying, big fan 🙂

  • @jesussantander6511
    @jesussantander6511 ปีที่แล้ว +1

    Amazing content Tim.

    • @timClicks
      @timClicks  ปีที่แล้ว

      Thank you! Please share with anyone who might be interested :)

  • @ivanchien4248
    @ivanchien4248 ปีที่แล้ว

    A nice video for Rust learners. btw can you tell me the code font you used in the slide?

    • @timClicks
      @timClicks  ปีที่แล้ว

      It's called Martian Mono github.com/evilmartians/mono

    • @ivanchien4248
      @ivanchien4248 ปีที่แล้ว

      @@timClicks thx!

  • @jackkendall6420
    @jackkendall6420 ปีที่แล้ว +3

    As a bit of constructive criticism, I would practice the voiceover once or twice before recording the final take, and read from a script if you aren't already. The ums and ahs distracted from the really quite high-quality slides.

    • @timClicks
      @timClicks  ปีที่แล้ว +2

      Thanks very much for taking the time to provide this comment. It's been on my mind for a while. The narration is currently unscripted, which lends itself to lots of distracting fillers. I'm aiming to steadily improve my delivery for another increase in quality over the next few weeks.

    • @jackkendall6420
      @jackkendall6420 ปีที่แล้ว

      @@timClicks That's excellent to hear. I've subscribed to support the effort you're obviously putting into this channel.

    • @timClicks
      @timClicks  ปีที่แล้ว

      @@jackkendall6420 Thanks Jack. Am curious to hear your opinion on this one th-cam.com/video/nCNjzoKHtHk/w-d-xo.html

    • @peter9477
      @peter9477 ปีที่แล้ว

      Or just invest more time in editing. It's not critical to do it in one shot, and many of the best videos from others have many cuts. But I'm subscribed too, to support the passion. :-)

    • @timClicks
      @timClicks  ปีที่แล้ว

      Thank you! More recent videos have better editing

  • @thegeniusfool
    @thegeniusfool 5 หลายเดือนก่อน

    It’s sad that this is so foreign and absurd to most so called senior developers.

    • @timClicks
      @timClicks  5 หลายเดือนก่อน

      Everyone's at their own stage in the journey.