Understand Function Composition By Building Compose and ComposeAll Utility Functions

  Рет қаралды 498

Andy Van Slaars

Andy Van Slaars

Күн бұрын

Пікірлер: 6
@vishalaggarwal2454
@vishalaggarwal2454 6 жыл бұрын
Best programming tutorials I have ever seen. Short and to the point. THANK YOU VERY MUCH!!!
@chamnil8666
@chamnil8666 4 жыл бұрын
you deserve more lkes.Amazing explanation.thank you.
@HekaFOF
@HekaFOF 7 жыл бұрын
Please continue doing these! Best Ramda vids I have seen :)
@AndrewVanSlaars
@AndrewVanSlaars 7 жыл бұрын
HekaFOF Thanks! Glad you like them! I have a bunch of these in a playlist on egghead. vnslrs.io/ramda I’ll still occasionally release some here, but that’s where most of my videos get published these days.
@Mr123anas
@Mr123anas 7 жыл бұрын
what if i want composeAll should increment then double then add?
@AndrewVanSlaars
@AndrewVanSlaars 7 жыл бұрын
That one is a little tricky. `add` has an arity of two, meaning it takes two arguments. Each function in a composition after the first one receives the return from the previous function as its input. A function can only return a single value. This means, in order to use `add` at the end of the composition, you need to know the first argument ahead of time and use the result of the previous function in the composition as the second argument.The simplest way to partially apply the first argument to `add` would be with `bind`. You can create a partially applied version of add like `const addFour = add.bind(null, 4)`. Then you can use `addFour` at the end of `composeAll` and it will add 4 and whatever value comes out of the previous step in the composition. Of course, there are utility functions for this sort of thing in libraries like Ramda where you could use something like `R.partial` to do what I described above. You might also look at a function like `R.converge` to approach this problem another way. I hope this helps.
Refactor a Promise Chain to Function Composition using Ramda
8:38
Andy Van Slaars
Рет қаралды 3,4 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 54 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 33 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 20 МЛН
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 43 МЛН
Introduction to RiotJS
19:36
Andy Van Slaars
Рет қаралды 25 М.
Compose and Pipe Functions in JavaScript | JavaScript Tutorial
12:08
RiotJS - Loops, Events and Callbacks
13:54
Andy Van Slaars
Рет қаралды 8 М.
Using Git Bisect
3:27
Andy Van Slaars
Рет қаралды 29 М.
Be more productive with git checkout --patch
6:08
Andy Van Slaars
Рет қаралды 7 М.
RiotJS and Redux - Part 3
7:50
Andy Van Slaars
Рет қаралды 2,7 М.
RiotJS - Server Side Rendering
19:45
Andy Van Slaars
Рет қаралды 8 М.
Faulty Anbernic RG35XX Hand Held Console | Can I Fix It?
40:20
Buy it Fix it
Рет қаралды 776
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 54 МЛН