Currying - Part 6 of Functional Programming in JavaScript

Sdílet
Vložit
  • čas přidán 16. 08. 2015
  • 💖 Support the show by becoming a Patreon
    / funfunfunction
    A short video explaining the concept of curring, using JavaScript. This is part of a series, where are learning functional programming using JavaScript.
    Currying is when a function, instead of taking all arguments at one time, takes the first one and returns a new function that takes the second one and returns a new function which takes the third one, and so forth, until all arguments have been fulfilled.
    Curry function in lodash:
    lodash.com/docs#curry
    Playlist of full series
    • Functional programming...
    You want to follow me on Twitter and Quora:
    / mpjme
    www.quora.com/Mattias-Petter-J...
    💛 Follow on Twitch
    We record the show live Mondays 7 AM PT
    / funfunfunction
    💛 Fun Fun Forum
    Private discussion forum with other viewers in between shows. www.funfunforum.com. Available to patron members, become one at / funfunfunction
    💛 mpj on Twitter
    / mpjme
    💛 CircleCI (Show sponsor)
    Robust and sleek Docker-based Continuous Integration as a service. I used CircleCI prior to them becoming a sponsor and I love that their free tier is powerful enough for small personal projects, even if they are private. Use this link when you sign up to let them know you came from here:
    circleci.funfunfunction.com
    💛 Quokka (Show sponsor)
    Wonder how MPJ evaluates JavaScript inline his editor. Quokka is the answer - use this link when you buy to let them know you came from here:
    quokka.funfunfunction.com
    💛 FUN FUN FUNCTION
    Since 2015, Fun Fun Function (FFF) is one of the longest running weekly CZcams shows on programming 🏅 thanks to its consistency and quality reaching 200,000+ developers.
    🤦‍♂️ The Failing Together concept is what makes FFF unique. Most coding content out there focus on step-by-step tutorials. We think tutorials are too far removed from what everyday development is like. Instead, FFF has created a completely new learning environment where we grow from failure, by solving problems while intensively interacting with a live audience.
    Tutorials try to solve a problem. Failing Together makes you grow as a developer and coworker.
    📹 Each show is recorded live on Twitch in a 2-hour livestream on Mondays. The host, assisted by the audience, is tasked to complete a programming challenge by an expert guest. Like in the real world, we often fail, and learn from it. This, of course, reflects what the audience identifies with, and is one of the most praised aspects of the show.
    ⏯ On Fridays, an edited version of the show is adapted for and published on CZcams.
    Content Topics revolve around: JavaScript, Functional Programming, Software Architecture, Quality Processes, Developer Career and Health, Software Development, Project Management
  • Věda a technologie

Komentáře • 436

  • @2thinkcritically
    @2thinkcritically Před 9 lety +199

    I woke up this morning and thought "Ugh, it's Monday". And then I thought "Yay! It's Monday!"
    Thanks for improving Mondays :)

    • @funfunfunction
      @funfunfunction  Před 9 lety +43

      Wow, what a cheery comment! Thank you so much!

    • @newe1344
      @newe1344 Před 8 lety +12

      function thankYouMessage(name) {
      return function(reason) {
      console.log(name + ', Thank you for ' + reason);
      }
      }
      var thankFunfunfunction = thankYouMessage('+funfunfunction');
      thankFunfunfunction('improving my Mondays as well!');

    • @tomaszcysewski3225
      @tomaszcysewski3225 Před 7 lety +1

      Hey, what would be diffrent if I would use that?
      function thankYouMessage(name,reason) {
      console.log(name + ', Thank you for ' + reason);
      }
      thankYouMessage('funfunfunction','improving my Mondays as well!');
      why are closures useful for?

  • @mario1ua
    @mario1ua Před 7 lety +14

    0:35 Great quote. Indeed.
    "Does it sound confusing? Good! The feeling of confusion is your friend, it means you're learning."

  • @EllenSpertus
    @EllenSpertus Před 8 lety +72

    Thanks for this great video! I teach Programming Languages, and you explain currying much better than I did. One of my students recommended your video, and I'm recommending it to the rest of them. I like both the content and the attitude.

  • @WalkerLeite
    @WalkerLeite Před 8 lety +168

    That moment when you finally realises how this stuff works and your mind explodes

    • @haleemulhassan9158
      @haleemulhassan9158 Před 7 lety +41

      still waiting for that moment. I want that moment

    • @AnshumanVenkatesh
      @AnshumanVenkatesh Před 7 lety +11

      For me it came at around 6:49 when he removed the 'x =>' part that is so much associated with map/reduce/filter function be it in python, js or scala. And instead he just passed a function!!

    • @Yarkhan
      @Yarkhan Před 7 lety +1

      also blown my mind exactly at that point

    • @sergy4617
      @sergy4617 Před 7 lety

      I think he was passing a function previously also :) But after currying, our callback fn is returning something itself without needing second argument. This is why we don't need a fn (having x here) and a return statement (with fat-arrow =>). Am I right +funfunfunction?
      BTW, great, funny, simple videos. Your videos are a great starting point to dig the subjects.

    • @mdoerkse
      @mdoerkse Před 4 lety

      @@AnshumanVenkatesh That is exactly the point where my brain stopped working. I think I need to take the red pill that Neo took in the Matrix...

  • @DanylCh
    @DanylCh Před 7 lety +92

    in ES6 without lodash or any deps:
    const dragons = [
    { name: 'fluffykins', element: 'lighting'},
    { name: 'noomi', element: 'lighting'},
    { name: 'karo', element: 'fire'},
    { name: 'doomer', element: 'timewrap'},
    ];
    const hasElement = (element) => (object) => {
    return object.element === element;
    };
    const lightingDragons = dragons.filter(hasElement('lighting'));
    console.log(lightingDragons);

    • @ankhbayarbatsukh2694
      @ankhbayarbatsukh2694 Před 7 lety +11

      const hasElement = (element) => (obj) => obj.element === element;

    • @unev
      @unev Před 7 lety +5

      So does filter method implicitly invokes a consequent call with an array item as an argument?
      dragons.filter( hasElement('lighting') *(x)* )

    • @WalterVertigo
      @WalterVertigo Před 7 lety +8

      @Yevgeny The result of hasElement('lighting') is "function(object) { return object.element === element }" (or with ES6 arrow functions : "obj => obj.element === element" ) . That's is what filter expects to work.

    • @filemot25
      @filemot25 Před 6 lety +7

      You can even omit the parentheses and braces.
      const *hasElement* = element => object => object.element === element

    • @cbenmichael
      @cbenmichael Před 6 lety +4

      @Yevgeny I had the same question/confusion. For me, writing code inside filter's invocation caused me to forget that hasElement() is a *parameter* and not invoked immediately.
      I think the problem is in how I read the code. It is NOT "filter the dragons array with hasElement()" but instead read it as "the filter function will use hasElement() to filter the dragons array". (take it or leave it)

  • @gibsongtr
    @gibsongtr Před 6 lety +16

    These sessions are really good. The tricky part is being able to proactively put all of the pieces together in a design pattern to build an application. I'd love to see an "end to end-ish" reference architecture / design pattern & demo application that incorporates your approach to functional programming & object composition.

  • @ivofs
    @ivofs Před 8 lety +24

    First time I saw somebody showing a "real" example for currying!
    Thanks @mpjme

    • @heavydirtysoul1491
      @heavydirtysoul1491 Před 23 dny

      8 years has passed and nothing changed - yet it is a rarely good example. Though not even real.

  • @VladyVeselinov
    @VladyVeselinov Před 8 lety +64

    5 videos ago in this playlist: "Yes, I understand this!"
    5 minutes into this video: "Brain, please compute..."

    • @Kelderic
      @Kelderic Před 7 lety +3

      That's what I was thinking. The first part parts of this playlist ... yep, makes sense ... and then this one ... what the heck is this magic.

    • @unev
      @unev Před 7 lety +4

      Я так понимаю filter ожидает ссылку на функцию, а при каррировании получается что hasElement('lightning') возвращает ссылку на функцию + аргумент в замыкании. Видимо явно вызов выглядит как-то так:
      dragons.filter( (function (x) => x.element === 'lightning')(dragon) )
      Может иногда будет иметь смысл подготовить промежуточный вариант:
      const hasFire = hasElement('fire')
      dragons.filter( hasFire )

    • @beginswithaj
      @beginswithaj Před 3 lety

      @@unev as if just understanding the code in English wasn't enough o__o

  • @Shambo271
    @Shambo271 Před 6 lety +3

    "confusion is learning" Loved it! I'm going to used this with my kids! Great presentation and explanation.

  • @MarkDyck
    @MarkDyck Před 5 lety +1

    This is so awesome. I just wrote my first curry function based on some other code, then came over here to understand ‘why’ I wrote it like that. I love how you take the time to explain the reasoning behind the methods.

  • @ally_jr
    @ally_jr Před 9 lety +3

    Finally!!! It's Monday again!! Always the best way to start the week! thanks.

  • @jtbrick1217
    @jtbrick1217 Před 9 lety +2

    Great video! Thanks for making these, they are very helpful for understanding less talked about topics in javascript.

  • @paulcollins7525
    @paulcollins7525 Před 9 lety +2

    Thanks for these tutorials, they are truly mind expanding! Very well taught as well as entertaining.

  • @LOL-hc5fv
    @LOL-hc5fv Před 4 lety

    Just remembered how this video introduced this concept to me and changed how I code. I have enjoyed teaching it to people so they don't have to pass the same parameters to functions constantly. Thank you.

  • @josephc7212
    @josephc7212 Před 4 lety

    Best explanation of currying!! Mind exploded about two minutes in when it clicked.

  • @KraglaxEaterOfButts
    @KraglaxEaterOfButts Před 8 lety +1

    Wow you are incredibly talented at explaining tough concepts. Great job man seriously keep them coming please!

  • @laminebakri4002
    @laminebakri4002 Před 6 lety

    “The feeling of confusion is your friend it means that you are learning” Great quote !

  • @bugs181
    @bugs181 Před 8 lety

    Seriously, I love the way you explain things. Your mind is crazy awesome. I love how it works. Keep the videos coming! Subscribed and liked a few episodes ago. :)

  • @PranavSharma01
    @PranavSharma01 Před 7 lety +1

    That was amazing! I am learning curried functions in SML, this video was such a help to get the concept. Thank you so much.

  • @AndrewReeman_RemD
    @AndrewReeman_RemD Před 8 lety

    Thanks for explaining currying! It's taken quite a while to grasp how essentially simple it really is. You're video really secured this.

  • @masongoodnight3782
    @masongoodnight3782 Před 3 lety +2

    The lack of brackets and semicolons in your code is both exciting and terrifying at the same time.

  • @MsJisola
    @MsJisola Před 4 lety

    watching this almost five years later and your explanation was very helpful! Thank you!

  • @jimfoley2690
    @jimfoley2690 Před 2 lety

    I miss your video’s Monday morning is just not the same. Your videos are pure gold and new dev’s are find the help they need still thanks to you

  •  Před 4 lety

    You made me understand "Currying and Closure" which I did not understand easily before! Thank you so much! I'm sure that I will learn a lot of stuffs thanks to you!

  • @joeygarcia7826
    @joeygarcia7826 Před 2 lety

    Yeah, I agree with everyone else! Great video on a complicated topic, I think this topic and my Dyslexia have major issues but this was the best video on this topic. I feel like he is done with this channel now because no new videos in a year or he is focusing on patreons, which is fine, there is a lot of content going back 6 years, so I can understand. Thanks again. Even the background music was perfect!

  • @JayDoge
    @JayDoge Před 8 lety +102

    So, why use currying instead of a regular function ? What does it accomplish ?

    • @tomaschmelevskij623
      @tomaschmelevskij623 Před 7 lety +41

      -Jean-Baptiste Bouhier modularity. Rather than having one quite rigid function you can swap every part/operation with the new one. And if needed you can apply multiple different functions to the same thing quite easily. If you checked any more stuff about functional programming and even mpj's previous videos, in functional programming you sort of build your toolbox of functions which you can reuse across the different projects. So than you can curry your functions you can chain them up quite easily.

    • @ebuzertahakanat
      @ebuzertahakanat Před 7 lety +9

      partial application

    • @rodrigogarcia6842
      @rodrigogarcia6842 Před 6 lety +4

      "Currying is related to, but not the same as, partial application." - en.wikipedia.org/wiki/Currying

    • @altalena9139
      @altalena9139 Před 6 lety +18

      From my understanding, having a Curry'd function is better than having a "normal" function when you don't know exactly what all the parameters are of the functions. Having a Curry'd functions means that you can pass one parameter into the function before working out what the other parameters will be

    • @Vendavalez
      @Vendavalez Před 6 lety +14

      OK, I believe you. I didn't believe in functional programing until I had to work through an example. Does anyone know of a good place where there is an example that shows the use of it in contrast to something that is inferior? The example of an improvement in this video is a little contrived.
      (I should add that I feel like it is a great video otherwise. This is my first time coming across this concept and I feel like I get it. The only thing is that I am not sold out into how could it improve my functions. One word answers and simple examples help you know the why, but not necessarily to understand the why.)

  • @Sean-hs7zj
    @Sean-hs7zj Před 7 lety

    So glad I stumbled across your vids. I am currently falling in love with javascript because functional programming

  • @jasonwiesner5539
    @jasonwiesner5539 Před 4 lety

    Thanks again! Great video, as always! Great refreshed to currying.

  • @shuaibird.official
    @shuaibird.official Před 7 lety

    I've used the curry function before but haven't realized that it could be more powerful when passed as an callback function to the filter
    this is awesome

  • @nosajghoul
    @nosajghoul Před 8 lety

    Im at 3:40 and bracing myself for the inevitable 'this allows you to make things more COMPOSABLE' speech. :-) Maybe its just me but ever since I saw him say that in a video a few weeks back, it has resonated. These chunks of code are now like legos to me. Mind blown.

  • @kirillkamudo8575
    @kirillkamudo8575 Před 7 lety

    These videos are sooo good, thank you so much for sharing!

  • @mattmcdaniel6412
    @mattmcdaniel6412 Před 8 lety

    Your videos have been a fantastically thorough resource to help me learn some of these intermediate - advanced JS concepts, so thank you for that. But I read through the comments here and saw that you, yourself don't use currying and only sometimes use partials. I watch these videos not only because I trust what you're telling me is true, but also because I trust that what you're teaching is worth learning. Just wanted to be a voice in this discussion. Thanks for your instruction and keep up the great work!

    • @funfunfunction
      @funfunfunction  Před 8 lety +1

      +Matt McDaniel Actually use currying more after this episode. :) Ramda.js is very addictive. That said, I agree - I think I did a bit of mistake with the currying episode, because I did it was what the majority asked for rather than something that I was personally excited about.

  • @kevin179887
    @kevin179887 Před 3 lety

    You are a strange and crazy person; I love it! This was a great video that simplified currying to a level even I can understand. You're a wizard!

  • @oprearocks
    @oprearocks Před 8 lety

    You have a really good way of explaining things and presenting them to people. Really appreciate the effort you put in creating all this valuable content.

    • @funfunfunction
      @funfunfunction  Před 8 lety

      +Adrian Oprea Thanks a ton for your kind words, really motivates me to keep on going!

  • @LillyCode
    @LillyCode Před 5 lety

    You're amazing man :) You make me laugh, learn and get excited about coding. Thank you so so so much

  • @irvingv8
    @irvingv8 Před 6 lety

    TY for this video MPJ! really helped me out with this one.

  • @kevinbegin3049
    @kevinbegin3049 Před 2 lety

    love this video. informative and super entertaining. well done!

  • @vedovelli
    @vedovelli Před 8 lety +5

    This one is not so easy! Gonna have to re-watch it and try myself before wrapping my mind around it! Thanks a lot!

    • @funfunfunction
      @funfunfunction  Před 8 lety +3

      Yeah, I know it's a bit tricky this one. Currying is just one of those things that you have to go a little bit yourself to truly get.

    •  Před 8 lety +1

      +funfunfunction To be honest, you using ES6 did not really help. :) But, thank you anyway. :)

  • @shitijgupta29
    @shitijgupta29 Před 7 lety +2

    I am a simple Indian, I see curry, I press like. :D

  • @alaamansour5538
    @alaamansour5538 Před 4 lety

    i love to code and i even love it more because mpj is teaching me how to code.

  • @abu_bakkar
    @abu_bakkar Před 3 lety

    Best learning experience so far. Thanks a lot

  • @tammyton
    @tammyton Před 7 lety

    Your videos are amazing. They answer all the questions that I have :-)

  • @jackriley5960
    @jackriley5960 Před 4 lety

    I have no idea why I am watching this video I’m done with finals but somehow you made fucking currying interesting. Wish I would have found this channel earlier this semester. Hope ur channel grows!

  • @MikeJfromVA
    @MikeJfromVA Před 8 lety

    You are so entertaining! I'm an instant fan.

  • @TheDataArchitect
    @TheDataArchitect Před 6 lety

    Man, you are the best :) just implemented in different scope :)
    function init(name) {
    alert(name);
    return function displayName(verb) {
    alert(verb);
    return function me(praise) {
    alert(praise);
    }
    }
    }
    init("MPJME")("is")("kool...:)");

  • @tylerwilliams3430
    @tylerwilliams3430 Před 8 lety

    Hey there, I found your channel about a week or so ago and I must say it is probably the most entertaining programming channel I've ever visited. You clearly know the material and explain it in an authoritative (and humorous) way. Definitely subscribing and will continue to watch new videos each Monday.
    I did have one question in regards to this video. You mention that one of the strengths behind currying is the ability to build up a function's arguments incrementally. What is the advantage of doing this over just simply using a specification object as a function's argument and passing that around to add properties to it?

  • @katryndmitruk318
    @katryndmitruk318 Před 8 lety

    mpjme, thank you for the easiest and best explanation of currying!

    • @funfunfunction
      @funfunfunction  Před 8 lety

      +Екатерина Дмитрук Thanks a ton - that's so nice of you say.

  • @fallenstar358
    @fallenstar358 Před 3 lety

    Thank you because thanks to you I learned finally currying! Im grateful bro, I hope you are okay and soon will makw videos for us, you can explain so simple and nice, its very awesome!

  • @josue-cedeno
    @josue-cedeno Před rokem

    Very helpful and entertaining! Thanks!

  • @RickyGarcia_Learning
    @RickyGarcia_Learning Před 7 lety

    MPJ, you're the man. I always check out your videos when I need to brush up on a topic. With that being said, how come you used arrow functions but not template literals in this video?

  • @videderien2
    @videderien2 Před 7 lety

    Tks a lot. Great serie of videos !

  • @Middollo
    @Middollo Před 5 lety

    Superb explanation, thanks!

  • @antoinebejjani8778
    @antoinebejjani8778 Před 2 lety

    what’s more important is to understand that all this is made possible because of closures. A function returned by another function will not have access to its parent scope variable environment in its execution context unless it “closes” that environment when it’s function is called.

  • @filip23128
    @filip23128 Před 2 lety

    Brilliant video, thanks!

  • @RomanOstolosh
    @RomanOstolosh Před 7 lety

    Nice video. Thanks for that.
    I've never known that there is a `partial` and `currying` functions in lodash.
    I've been using `bind` all the time for that. As you mentioned in the comments `currying` and `partial` are different, and it would have been nice if you'd mentioned it in the video and elaborate on it. Because when I used `bind` I though I was doing currying, and I believe lots of people confuse them too.

  • @eddiegomez4134
    @eddiegomez4134 Před 5 lety

    Man you slayed this! Thanks!

  • @GuillermoValleCosmos
    @GuillermoValleCosmos Před 8 lety

    Thanks! These videos are so nice

  • @julianabalta
    @julianabalta Před 2 lety

    You're an amazing teacher, please come back! 😍

  • @dudeinthemirrorl587
    @dudeinthemirrorl587 Před 7 lety

    Hi MPJ, awesome videos, thank you !
    One observation though : at line 14, I think we need to pass (x) as well:
    // Original :
    let hasElementCurried =
    _.curry( (value, obj) => obj.element === value )
    let lightningDragons =
    dragons.filter(x => hasElementCurried('lightning')) // hasElementCurried('lightning')(x)) //

  • @JoshuaGish
    @JoshuaGish Před 9 lety +5

    My heart is happy 🌿

  • @igorpavlenko411
    @igorpavlenko411 Před 4 lety

    thx man finally understood the concept !!

  • @smoothbeak
    @smoothbeak Před 3 lety +1

    I think I understand "how" this works, but I can't say this jumps out at me as being particularly useful or more readable.

  • @rafaelcoelho5226
    @rafaelcoelho5226 Před 5 lety

    Good work mpj!

  • @jamesdouglas6400
    @jamesdouglas6400 Před rokem

    Great explanation, thank you!

  • @JnsWndlmth
    @JnsWndlmth Před 9 lety +1

    Thanks, great video!

  • @rubyam1
    @rubyam1 Před rokem

    Thanks for the explanation of currying

  • @x0rZ15t
    @x0rZ15t Před 7 lety

    MIND. BLOWN!!!!

  • @exquisiteoath
    @exquisiteoath Před 8 lety

    HI!
    While I still don't know that I'll find many use cases for Curry (or Partial) for that matter, at least I finally understand it! (to put this in perspective, I've been coding for 10+ years and regularly use some amount of functional programming in my everyday work... I've just never quite grokked currying despite the pages and pages I've ready about it)

  • @sakshambhatt7510
    @sakshambhatt7510 Před 2 lety

    Excellent explanation!

  • @MikeFieldenJr
    @MikeFieldenJr Před 9 lety

    These are really great thanks!

  • @ventures9560
    @ventures9560 Před 2 lety

    I love this guy!

  • @x9wozz
    @x9wozz Před 4 lety

    For all of you who still don't know why the hasElement function doesn't have x argument passed.
    Filter method when called on array doesn't need said x argument as it's optional overwrite of 'this' which at the time the array that the filter method was invoked on (look up on mdn)

  • @NikolaiAleksandrenko
    @NikolaiAleksandrenko Před 8 lety

    Curring with filter is very, very cool :D
    Can you show more useful and real examples?
    Thanks for the great series.
    It's very well balanced for the newcomers and people with some background.
    Please make more real case examples making the new info more useful! :)

  • @wdoering01
    @wdoering01 Před 4 lety

    very good, still hard to see myself refactoring code daily using currying.... But its good to know it since its a frequent topic in JS interviews! :D

  • @ignorance1Zbliss
    @ignorance1Zbliss Před 7 lety

    i was planning on spending the day figuring out currying, now i just need to figure out what to do with the rest of my day!!! :)

  • @hayatasuenaga7028
    @hayatasuenaga7028 Před 3 lety

    amazing tutorial thank you very much!

  • @Kad959
    @Kad959 Před 3 lety

    Excellent explanation.

  • @rajatbajpai25
    @rajatbajpai25 Před 9 lety

    Enlightening Monday!!!

  • @idrissyed9089
    @idrissyed9089 Před 6 lety

    Here is an ES5 version for the same, for understanding purpose.
    var dragon = function(name) {
    return function(size) {
    return function(element) {
    return name + " is a " + size + " dragon that breathes " + element + "!";
    }
    }
    }
    var output = dragon("karo")("large")("ice");
    console.log(output);

  • @Neppord
    @Neppord Před 9 lety +1

    I think its worth mentioning partial in the context of currying. Thanks for the great video.

    • @funfunfunction
      @funfunfunction  Před 9 lety +2

      Samuel Ytterbrink Yeah, I had that in there first but the video got really long and it was hard to get coherent. Might do another one on that.

    • @sam.c3359
      @sam.c3359 Před 9 lety

      mpjme +1 on another video on Partials :-)
      I've almost wrapped my head around currying but still don't quite see why to do it.
      Thanks for your vid's.

  • @BennyPowers
    @BennyPowers Před 6 lety

    Thanks, helped me grokk currying a little better. Would like to see a less contrived example, since in the case of hasElement, we control the function and could curry it ourselves as `const hasElement => element => obj => obj.element === element`

  • @alexanderbrown1178
    @alexanderbrown1178 Před 7 lety

    A great video as always. Thanks for all you do. :) This works for a fixed number of arguments - what if I want to have an indefinite number of function calls though? For example, adding or multiplying a bunch of numbers. Maybe a bad example as it's probably easier to take all the arguments at once, convert them to an array and then reduce, but I'm interested in principle...

  • @amandacapsicum686
    @amandacapsicum686 Před 4 lety +5

    I shed a tear for the semicolons lost in this video. :'(

  • @Samuel-wl4fw
    @Samuel-wl4fw Před 3 lety

    Thanks, very good example

  • @Pastshelfdate
    @Pastshelfdate Před 6 lety

    Hi, MPJ,
    I think I can manage nice and funny, even though I didn't understand this one well at all. Curry makes me think of "Red Dwarf." My friend Dustin, who introduced me to Fun Fun Function, knows how to manipulate images. I'll research images of Lister, Rimmer, Kryton, and Cat, and try to sum up, briefly, what they'd say in reaction to currying. Dustin can put the elements together.
    I'm thinking ...
    Lister: Coding? So not me, except for this 'currying' thing."
    Rimmer: "Reminds me too much of you, Lister."
    Kryton: "I've been doing this all the time, and did anyone ever notice?"
    Cat: "Great! Now I'm hungry!"

  • @purovenezolano14
    @purovenezolano14 Před 8 lety

    I actually lol'd at the "post-production leviosa"

  • @fhmtz
    @fhmtz Před 9 lety

    Excellent video!
    I really love your style, extremely clear and concise.
    I noticed that you are using babel-node engine instead of node, because of it's support for ES6.
    As ES6 turns Javascript to being even a more functional programming language, it would be interesting, if is possible, for you to cover the functional programming basics (use of constants, pure functions, etc.)
    Thank you for your precious time and keep the videos coming =)!!

    • @funfunfunction
      @funfunfunction  Před 9 lety

      Thank you! Yes, going down into basics more and more is the idea (immutability and purity are definite future videos) - in fact, that is sort of the idea with the channel in general. A lot of people come into programming tooling-first nowadays, doing quite complicated things with tools, but lack the fundamentals to understand and build those tools themselves. This is where I came from as well. My idea is to move down from tools into computer science fundamentals and designs patterns, and letting other people do framework tutorials.

    • @fhmtz
      @fhmtz Před 9 lety +1

      Thank you for taking time to read (and also reply!!) my comment.
      I watched all your videos so far and I really love your approach to teaching, both in the tutorials and the long-term approach that you just explained.
      You really encourage people to stay curious, not only by telling them to do it :)
      Keep the tutorials coming!! Thank you!!

  • @tieskedh
    @tieskedh Před 8 lety

    Thanks for helping learning scala!

  • @mluevanos
    @mluevanos Před 8 lety

    Nice video series. Keep it going,

  • @yifengjiang25
    @yifengjiang25 Před 7 lety

    perfect tutorial, it's awesome. thx a lot

  • @amirrosner3243
    @amirrosner3243 Před 6 lety

    An amazing video!

  • @shakilthakur2674
    @shakilthakur2674 Před 3 lety

    when i watch, Wow! everything is clear. but after finishing the video. my head is warm up and watch the video again. :)

  • @supershazwi
    @supershazwi Před 8 lety +11

    Why can't it be
    let lightingDragons = dragons.filter(hasElement('lightning')(x))
    I'm using your example of
    let output = dragon('Karo')('large')('ice')
    Why did you omit the x?

    • @adrianabreu1565
      @adrianabreu1565 Před 8 lety +14

      +Shazwi Suwandi Hi
      Filter is doing it automatically, a quick example done in the browser
      function my_head(x) {
      return x == 1
      }
      my_arr = [0,3,1,2,1,1]
      my_arr.filter(my_head);
      Array [ 1, 1, 1 ]
      As you see, filter called my function and passed it X. That's what happened on the curry.
      (x) is done automatically

    • @supershazwi
      @supershazwi Před 8 lety +2

      +Adrián Abreu González Oh I get it now. I was wondering where the x went. Thank you.

    • @bhargavshah878
      @bhargavshah878 Před 8 lety +1

      Oh I get it now. This comment should go to the top. Almost forgot that you can pass a function value as an argument to filter :)

    • @DB4331
      @DB4331 Před 6 lety

      This is a easy helpful example. Thanks.

    • @dennisgatere7821
      @dennisgatere7821 Před 5 lety

      Let me just add a comment to this though its been years, that would be absolutely true but the presenter used lodash as opposed to writing the full version as he did in his initial example. In that case writing it out manually you would have to pass the obj as second parameter explicitly.
      const hasElement = element => obj => obj.element === element;
      const lightningDragons = dragons.filter(d => hasElement('lightning')(d));
      console.log(lightningDragons);
      This should now work exactly the same as MPJ's lodash example, omitting the argument (d) in this case would make the filter fail.

  • @turmadaembrosia6864
    @turmadaembrosia6864 Před 4 lety +1

    i've never learned so much in my whole life

  • @moshekarmel8532
    @moshekarmel8532 Před 8 lety +2

    "The feeling of confusion is your friend, it means you are learning" LOL

  • @selftaughtcodelab
    @selftaughtcodelab Před 6 lety

    Awesome explanation.Wow

  • @SoeaOu
    @SoeaOu Před 8 lety +6

    I don't understand this but love it anyway!

    • @theunnamed89
      @theunnamed89 Před 8 lety

      +Hoto hahaha I've been watching your comments through all the videos and actually I was thinking the same: this one is not easy but still love it

  • @jimcab1853
    @jimcab1853 Před 2 lety

    Well done. Thanks

  • @RodrigoMMartins
    @RodrigoMMartins Před 5 lety

    It`s a bit advanced for me. I'll watch it again. My english isn`t so good yet to get so much details in only one simple watch. Congratulations Mattias Petter Johansson.

  • @eugenea8264
    @eugenea8264 Před 6 lety

    Thanks, good to know this stuff.