Swift Tips #35 - reduce

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

КОМЕНТАРІ • 17

  • @v_pradeilles
    @v_pradeilles  3 роки тому +4

    Did you find this tip useful? Are you planning on using it in your apps? Let me know in the comments 🚀

  • @sk4tec
    @sk4tec 9 місяців тому

    Great videos - love this short format perfect for playing and learning in Playground! ♥

  • @toshanmugam
    @toshanmugam 3 роки тому

    Excellent tips

  • @innovalonia
    @innovalonia 3 роки тому

    Awesome simple example how to use reduce! Congrats! Which functional programming tools do you think are more usefull?

  • @nathca93
    @nathca93 2 роки тому

    Thank you!

  • @Prashant-7
    @Prashant-7 7 місяців тому

    I am curious about + operator , suppose we need to develop similar like either pass closure or +operator do we need to add argument with default nil value or some other overload?

  • @bonnydonny
    @bonnydonny 3 роки тому +1

    I ❤️ reduce.

  • @craigswanson410
    @craigswanson410 3 роки тому +1

    I did find it useful, I didn't know about reduce(). My question: is It the same time complexity as a for-loop or is it better?

    • @v_pradeilles
      @v_pradeilles  3 роки тому +4

      Good question! It’s the same complexity as in a for-loop: the same number of operations is being executed, it’s just a different API around them.

  • @alexvlad9495
    @alexvlad9495 3 роки тому

    Cool vis man. The intro sound is so loud and the rest so quiet. Can you bump up the sound on the part you are talking ? Thanks !

    • @v_pradeilles
      @v_pradeilles  3 роки тому +1

      Sorry about that! Matching audio level turns out to be always more challenging than it looks 😅

  • @sohailurrahmans2530
    @sohailurrahmans2530 2 роки тому

    I want to understand one thing how the Value in closure takes values of array as we do not specify that values should be actual values and not their index. Pls clarify

  • @obsessed92
    @obsessed92 2 роки тому

    Hi Vincent. Do you know maybe why the result for reduce(into:) is in a random order ?

    • @v_pradeilles
      @v_pradeilles  2 роки тому

      It indeed shouldn’t be in random order. Are you getting a random order using the code I showed in the video?

    • @obsessed92
      @obsessed92 2 роки тому

      ​@@v_pradeilles Yes the code is exactly the same and I'm getting this result in an xcode playground and on the online compilers :/

    • @PagaFantas-v4m
      @PagaFantas-v4m 4 місяці тому

      This randomness is normal for Dictionaries and Sets since by nature these collections are nor ordered. The way the elements are hashed differs from run to run. I don't know about the internals but it could be due to random seeding, possibly for security reasons.