Skip to content

Instantly share code, notes, and snippets.

@davidbarral
Last active February 12, 2018 11:02
Show Gist options
  • Save davidbarral/31d460fc9735b46d2f15e47cc08a22bb to your computer and use it in GitHub Desktop.
Save davidbarral/31d460fc9735b46d2f15e47cc08a22bb to your computer and use it in GitHub Desktop.
Curry: Ramda
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