R.curry((a, b, c) => {})
vs a => b => c => {}
f(a,b,c)
f(a,b)(c)
f(a)(b)
f(a, b)
f(_, b)(a)
fluture
! :clap:
R.__
to easily adapt my partial applications
f(_, b)(a)
R.__
let
, you wouldn't need the in
part because the let
is bound for the remainder of that block
where
notation
const
actually for where
const
is variable hoisted
where
notation the most :(
var
?
const
nor let
are hoisted as far as I know
const
is hoisted
const
is hoisted in a way that would allow for where. The definition is hoisted but assignment is not.function
if we want to use R.curry
What's the benefits of using R.curry vs manually currying function using ES6 arrow function ?
Just wanted to jump in and say there are benfits to sticking with arrow functions. Debugging, less indirection, type inference. (probably) performance.
I'd love a ramda build that was just arrow functions.
R.__
somehow
expression...where
I don't see how to do it without using var
flip
yield
them, but in all honesty considering how JS bind
s this
, you're probably better off using arrows
const flip = (fn) => (a) => (b) => fn(b)(a)
((a, b) => console.log(a + b))(2, 5)
ReferenceError: console is not defined
((a, b) => a * b)(2, 5)
10
where
would just be calling the function with (2, 5)
const def = fn => ({
where: obj => (function(obj) {
Object.keys(obj).forEach(key => this[key] = obj[key])
fn()
})(obj)
})
def(() => {
console.log(a + b)
}).where({ a: 2, b: 5 })
R.when
updateEntityType
expects the only param to be a string, while map
will pass whole object
R.evolve
seems to fit better
R.assoc
call
@6ewis Here:
let updateEntityType = (entity) => R.assoc('entity_type', serializeEntityType(entity));
R.assoc takes 3 parameters: the field, the value, and the object. the updateEntityType function is only passing it 2 values.
It should look like this:
let updateEntityType = (entity) => R.assoc('entity_type', serializeEntityType(entity), entity);
Once I did that the code worked.
updateEntityType
function. That function takes a single parameter, entity
, and returns the curried function.
R.assoc
s that you are returning from updateEntityType
where
syntax though
R.curry
there
let scopeName,
variableName;
for (scopeName of Object.keys(commentsData)){
if (!D.vr[scopeName]) {
D.vr[scopeName] = {};
}
for (variableName of Object.keys(commentsData[scopeName])){
D.vr[scopeName][variableName] = commentsData[scopeName][variableName];
}
}
R.evolve
let commentsData = { //intial
comment1: {
text: "I am the first to comment, well written! Bravo!",
date: "In the year 2016"
},
comment2: {
text: "I really appreciate your work",
date: "yesterday"
}
};
serializeNullValue
implementation
R.curry
, you don't need it
serializeNullValue
over all the keys?
D.vr = R.merge(D.vr, commentsData)
?
R.mergeWith
if there are already comments in D.vr