input is
['apple', 'the', 'one', 'two', 'three', 'elephant', 'whatever']
var filterByLength = R.filter(function(str) {
return str.length > 3 && str.length < 6;
});
desired output is
['apple', 'three']
R.lt(x, y)
means x < y
and curried arguments apply left to right. https://github.com/algesten/fnuc exists mainly because that's Kind of Weird.
fn(a, b) === fn(a)(b)
for Ramda functions. To say its the same except for certain non-commutative operators was problematic. And we probably couldn't just say binary functions, either, or would you expect R.map(fn, list)
but R.map(list)(fn)
? Madness.
gt
and lt
, like I explained. It's not the end of the world, but Ramda's argument order has started to make a lot of sense to me, until I met gt
and lt
just now. :P
R.pipe(R.add, R.map)(10)([1, 2, 3])
lt
, gte
, etc. We had subtractN
, divideBy
, and such, but no good names for these.
R.lt(7, 12)
just seems to me it should return true
and divide(20, 5)
should return 4
not 0.25
. fnuc
was built around trying to solve this issue, but I think it ends up somewhat incoherent.
R.lt(6)
to test if the following value is less than 6. I think I've even used it like that to explain currying to colleagues. :P
R(x)
, all of Ramda's functions are partially applied with x
, and the results are returned in an object. That's an interesting way of doing things. :P
R.compose
/R.pipe
, there's nothing special about Ramda functions; you can pass anything you want. So, while you could do something like `R(3).someRfunc, the only way I know to make it more generic so that you could apply any other function you like is with a stateful registration process.
R
itself as the function.
compose
changes.