||> const r = f => function r(...args){
f(...args);
return r;
}
const addKeyValues = obj => Object.assign(
r((k, v) => obj[k] = v),
{result: obj}
);
const input = ["apple", "banana", "cherry"];
const { result } = input.reduce(
(acc, item, i) => acc(i+1, item),
addKeyValues({})
);
console.log(result);