map for async iterators in JavaScript

Поділитися
Вставка
  • Опубліковано 3 жов 2024
  • 🔗 Pusher - pub/sub, push etc (sponsored)
    pusher.funfunfu...
    🔗 (Patrons only) Official discussion topic for this episode on the Fun Fun Forum:
    www.funfunforu...
    🔗Code from the episode
    beta.observabl...
    🔗 Playlist for this series
    • map for async iterator...
    🔗 Array.map video
    • Map - Part 2 of Functi...
    🔗 Support the show by becoming a Patreon
    • Patreon + Fun Fun Foru...
    🔗 mpj on Twitter
    / mpjme
    🔗 Help translate the show to your language
    www.youtube.com...
    We follow up with how to implement map for async iterators in JavaScript. We also foray into some cool functional programming techniques in JavaScript, such as function composition, currying and pipelining.

КОМЕНТАРІ • 61

  • @vjself
    @vjself 4 роки тому +1

    This i such an incredible series. It taught me iterators and generators and gave me the tools to achieve what I needed to at my job this week in a MUCH MUCH more efficient fashion. Thank you sir. I really appreciate it.

  • @ErnestGWilsonII
    @ErnestGWilsonII 6 років тому

    Thank you for another great video @mpj! I am of course subscribed with notifications turned on and thumbs up! It is hard to get started on Monday mornings, Fun Fun Function makes life nicer for all of us! (That is why I am a patron!)

  • @alfioparisi
    @alfioparisi 6 років тому +7

    Hello, thanks, I've been learning a lot from you.
    Just a clarification, please, I'm not sure if I get the flow right.
    What happens here is that `pipe` returns a function, to that function we pass the call to `flickrTagSearch('cats')`, which returns an iterable. This iterable is passed into the first `map`, but `map` is a generator, so its call does not execute the body immediately, but rather returns another iterator/iterable. This goes inside `delay`, that just waits for 2 secs and returns it as-is. Finally this iterator goes inside the last `map` call, which has `preloadImage` as callback.
    At this point our program is not actually running, we just have an iterator, `cats`, waiting to be executed, which then would trigger the whole pipeline for each element (image). But we don't need to run this last step, because Observable runs it for us.
    Please tell me if I'm missing something. Thank you.

  • @pajotrus
    @pajotrus 5 років тому +3

    Hmm, this is one of your most advanced videos. I liked that it left me confused and made me think. This whole series starting from "Iterators in JS using Quokka" was one hell of a ride!

    • @funfunfunction
      @funfunfunction  5 років тому +3

      That feeling of confusion is your friend, it means you're learning! ❤️

  • @pogoking4000
    @pogoking4000 6 років тому

    Another way of making the .pipe cleaner would be to use .bind: delayed.bind(null, 2). Currying the function is much cleaner, but requires you to refactor it (which will break another pieces of code that use it). That's given that you don't use some kind of generic .curry higher order function. Anyway, great episode, thanks!

  • @lpussacq
    @lpussacq 6 років тому

    Hello there!
    As usual, awesome episode!
    I noticed the link for the map episode you spoke of @12:22 link to the "Good Bye" video of Travis from DevTips, Not sure that's what you wanted ;)
    Cheers !

  • @ajalbani
    @ajalbani 4 роки тому

    Extremely interesting

  • @ailijic
    @ailijic 6 років тому +3

    I like the music.

  • @clarejang9088
    @clarejang9088 6 років тому +2

    So is the next video about concatMap(or flatMap, whatever its name is)? :)

  • @ancoopa
    @ancoopa 6 років тому

    Great stuff. Thank you.

  • @sameedkhan9928
    @sameedkhan9928 6 років тому +1

    This is confident video making! It's clear how much effort you've put in it. Thanks for the great content; It made my day.

  • @plushy1emily
    @plushy1emily 6 років тому

    Have you seen this recent vid, "Callback Heaven - Andre Staltz," on using callbacks and oldschool javascript to do what Observables try to do? I thought it was super interesting:
    ua-cam.com/video/HssczgaY9BM/v-deo.html

  • @estephebouvet2147
    @estephebouvet2147 6 років тому

    This time I went full bananas with functional programming, streams and react :
    github.com/mesteche/react_stream

  • @jcubic
    @jcubic 6 років тому

    You can use bind for curry in JavaScript like with first version of delayed `delayed.bind(null, 2)` if delayed is normal function and not arrow one.

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

    understood all of the episodes, but this one is really tough to grasp. Gotta watching more times :D

  • @lukejagodzinski
    @lukejagodzinski 6 років тому +3

    Thanks for great tutorials on iterables. I feel like it would be better to explain such concepts on very simple examples instead of flicker feed, that would make entire tutorial more digestible :)

    • @funfunfunction
      @funfunfunction  6 років тому +1

      See the earlier videos in the playlist

    • @lukejagodzinski
      @lukejagodzinski 6 років тому +2

      I've seen all the iterable videos :) and I know that you were explaining these concepts with simpler examples and it would be good to continue this :). I know that real life examples are sometimes also necessary but just after explaining it on simple example :) but that's just my opinion :) so keep doing a good work :)

    • @funfunfunction
      @funfunfunction  6 років тому +4

      Thanks for your feedback, it's always good to hear the general feel from the viewer base. It's highly individual how people learn, and the two styles have different drawbacks. The problem with simple examples is that they become very disconnected from reality - it was clear that a big chunk of the audience just didn't get why this was valuable because the dragonArmy example was too constructed, and the database example was also hard to "get" for the same reason.

  • @ricardo.mazeto
    @ricardo.mazeto 6 років тому +2

    You can't have Earl without Toejam.

  • @durand101
    @durand101 6 років тому +1

    Seeing you delete all that code made me happy.

  • @zooeyboy
    @zooeyboy 5 років тому

    So... Can anyone give me an idea about how advanced these concepts are in the world of javascript programming? Would this be considered pretty advanced, or not at all?

    • @funfunfunction
      @funfunfunction  5 років тому

      This is definitely on the more advanced side.

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

    This was an amazing video... Thanks Mattias

  • @MaxDavydov-r2k
    @MaxDavydov-r2k 6 років тому

    You just blew my mind! Great episode, thank you MPJ! Btw, there is a proposal at stage 1 called Pipeline operator (developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Pipeline_operator), which would allow us to pipe functions without external libraries!

  • @matteogioioso896
    @matteogioioso896 6 років тому

    You are funnier than PewDiepie

  • @navroze92
    @navroze92 6 років тому +1

    Hey man you look really tired. Take a break. Go on a vacation smoke some pot and chill out. I cannot sense the same enthusiasm(not that I am complaining.Just that everyone needs a break) when you used to say good Monday morning.

    • @sweepstakes
      @sweepstakes 6 років тому +1

      He got more enthusiastic as he got into the currying though, it was just a bit subtle. Personally, I prefer relaxed MPJ to UA-camFace MPJ. The bossanova piano was a nice touch.

    • @joel_ricci
      @joel_ricci 6 років тому

      That's too funny :D
      He might have a point though...

  • @rebornreaper194
    @rebornreaper194 6 років тому

    You're scaring me. O_O ...or maybe exciting me. I can't decide!! lol

  • @ajalbani
    @ajalbani 4 роки тому

    if you have implemented map. does this become a stream by definition?

  • @sebastiendeseille9890
    @sebastiendeseille9890 6 років тому

    My mind exploded. \o/

  • @joel_ricci
    @joel_ricci 6 років тому

    Great, mindexpanding(mapping?) video. And thanks for fixing the audio :)

  • @OktayAcikalin
    @OktayAcikalin 6 років тому

    Great episode! Please take a cookie of your liking :)

  • @nassav3
    @nassav3 6 років тому

    Hello. My name is Url.
    Alot of Url

  • @edwinencomienda
    @edwinencomienda 6 років тому +2

    take some rest

    • @funfunfunction
      @funfunfunction  6 років тому +2

      Then there wouldn't have been a monday video. :)

    • @edwinencomienda
      @edwinencomienda 6 років тому

      Fun Fun Function hahaha you're dedicated thanks always watching your videos

  • @KimHogeling
    @KimHogeling 6 років тому

    As someone familiar with functional programming I really love this episode!

  • @jfuruskog
    @jfuruskog 6 років тому

    Fun Fun Function , Nice, show as usually. Wouldn’t it be nice to implementing pipe yourself? Ramada seems nice but we are just using it in one matter there for it seems unnecessary to use a the whole library?

    • @funfunfunction
      @funfunfunction  6 років тому

      I tend to use shitloads of functions of ramda when I program. Also there is docs for the function for people less familiar with fp that I don’t have to write - the implementation of pipe looks like abstract garble to someone new to FP.

  • @marcnitzsche
    @marcnitzsche 6 років тому

    4:03 I would love to have a remix of those awesome sounds someday :D

  • @konstantinnesterov6165
    @konstantinnesterov6165 6 років тому

    Thanks for these videos, they are very valuable for understanding iterators:) Currently I'm trying to come up with good patterns for retrying things in asynchronous context or handling errors in some different ways - i.e. skip some steps (business logic steps) or return back to some steps. Something that will let you embody a process diagram with ease. Would be great if you have any suggestions for that, thanks in advance :)

    • @funfunfunction
      @funfunfunction  6 років тому

      A normal promise chain would do what you describe, it's what they are for. If you could post an example I could perhaps make an episode about it.

    • @konstantinnesterov6165
      @konstantinnesterov6165 6 років тому

      I've just tried to flowchart the problem, like handling some failed parallel tasks or accumulating failed steps for retry and yes - promise chains should be good enough no matter what I try to add, thanks:) Looks like I needed some paper and a pen.

  • @puraniksaket
    @puraniksaket 6 років тому

    great video.

  • @ysaelpepin5717
    @ysaelpepin5717 6 років тому

    One of my favorite episode so far!!!

  • @sinyolinuxozy
    @sinyolinuxozy 6 років тому +1

    finally another awesome quality video!!!
    Good Monday Morning everyone :) (it's almost 4pm though here)

  • @pookage
    @pookage 6 років тому +5

    I find your lack of semicolons disturbing.

    • @funfunfunction
      @funfunfunction  6 років тому +5

      See the semicolon vdeo

    • @garretmh
      @garretmh 6 років тому

      It's such a silly thing for people to get emotional about as long as it's consistent. Same with tabs and spaces

    • @pookage
      @pookage 6 років тому

      This is where you'll hate me - I used mixed tabs and spaces, haha. Tabs for nesting indentation, and spaces for formatting; otherwise all my alignment will go out of whack if someone other than me opens the file and has different tab-spacing preferences to me.

    • @pietroviske
      @pietroviske 6 років тому

      I find your use of semicolons where they are not needed disturbing.

    • @randomuser66438
      @randomuser66438 6 років тому

      That's all about consistency. If you'll use semicolon, then stick to it and use it everywhere, and vice versa.