Transcript from the "Composing" Lesson
>> Bianca Gandolfo: So, composing is when you take two functions and combine them essentially. So, in this example, we have a function called consider and it's returning and I think it could be ...name. And then we have this other method called exclaim and it just takes a statement and it turns it into upper case and adds an exclamation point at the end.
[00:00:29] And then we have this function blame where we compose, consider and exclaim, so that it, when you pass you into this function, what it does is it first passes it into exclaim. We'll turn it into uppercase and put an exclamation point. And then it will pass that, whatever's returned from this into consider and then it will return at the end, I think it could be YOU!
>> Speaker 2: And why does it do that? Why does it start? Does order not matter?
>> Bianca Gandolfo: On the order, it does matter. The order does matter.
>> Speaker 2: Then why is it not starting with consider and then going to.
>> Bianca Gandolfo: It really depends on how you write the internals of this.
[00:01:22] But for underscore, this is the direction it goes.
>> Speaker 2: Okay.
>> Bianca Gandolfo: Yeah. So, it does this and then it does that.
>> Bianca Gandolfo: But it really just depends on how you write the internals, it's not, there's no like real purpose behind it that I'm aware of.
>> Speaker 2: So is kind of like the opposite of that where you have, say a function with multiple parts.
[00:01:50] It would run only part of it and then return the parts that hasn't run yet.
>> Bianca Gandolfo: So, for currying, it doesn't return anything.
>> Speaker 2: Okay.
>> Bianca Gandolfo: It kind of just waits until it gets all of the arguments and then it runs the function. So you can imagine that that curried function, has in its internal saved a copy of the original function and it's just kind of waiting as you add arguments.
[00:02:15] It's accumulating that but keep in mind, that every time you call a curried function and it hasn't met all of the required arguments, it has to return a function every time, that's the confusing and interesting part is how do you every time make sure that you're returning a function and also saving that.
>> Bianca Gandolfo: So but we'll come back to all of this and you'll be doing your excercise with currying and compose at the very end. And Professor Plum, like I said, he is also someone to consider reading towards the end of the presentation. So we have one more suspect, one more topic.
[00:03:05] And at the end, we're gonna figure out who the murderer is. So there's been clues throughout. It's okay if you didn't pick up on them. Either way, I'll tell you the answer. So.
>> Speaker 2: Or maybe never?
>> Bianca Gandolfo: Or maybe never.
>> Speaker 2: [LAUGH]
>> Bianca Gandolfo: Like at the end it's like, tune in for the next version of the workshop [LAUGH] where you'll really know who it is.
>> Speaker 2: [LAUGH] Yeah.
>> Bianca Gandolfo: And then the next time, don't reveal it either. [LAUGH]
>> Speaker 2: This one ends with another converter instead.
>> Bianca Gandolfo: I like that