Last active
February 12, 2018 11:02
-
-
Save davidbarral/31d460fc9735b46d2f15e47cc08a22bb to your computer and use it in GitHub Desktop.
Curry: Ramda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { curry, __ as _ } from "ramda"; | |
const sum4 = curry((a, b, c, d) => a + b + c + d); | |
// Currying | |
sum4(1, 2, 3, 4); | |
sum4()(1, 2, 3, 4); | |
sum4(1)(2, 3, 4); | |
sum4(1)(2)(3, 4); | |
sum4(1)(2)(3)(4); | |
sum4(1, 2)(3, 4); | |
sum4(1, 2)(3)(4); | |
sum4(1, 2, 3)(4); | |
// Using the Ramda placeholder! | |
sum4(1, _, 3, 4)(2) | |
sum4(_, 2)(1)(3, 4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment