const log = function(x){ console.log(x); return x; } const get = R.curry(function(prop, obj){ return obj[prop]; }) var people = [ {name: "Wan"}, {name: "Zhentian"} ]; var res = R.compose( get('name'), log, R.head )(people); console.log(res);
Using R.tap:
const log = curry((desc, x) => R.tap(() => console.log(desc, JSON.stringify(x, null, 2)), x));