Вы можете создать более общую функцию, которая генерирует все виды фрагментов:
const foldChunks = (len, step) => f => init => xs => {
const aux = (acc, i) =>
i + len > xs.length ? acc
: i + step > xs.length ? f(acc) (xs.slice(i, i + len))
: aux(f(acc) (xs.slice(i, i + len)), i + step);
return aux(init, 0);
};
const xs = ["a","b","c","d","e","f","g","h"];
console.log(
foldChunks(2, 1) (acc => ([s, t]) => (acc.push(s + t), acc)) ([]) (xs));
console.log(
foldChunks(2, 2) (acc => ([s, t]) => (acc.push(s + t), acc)) ([]) (xs));
console.log(
foldChunks(2, 3) (acc => ([s, t]) => (acc.push(s + t), acc)) ([]) (xs));
console.log(
foldChunks(3, 1) (acc => ([s, t, u]) => (acc.push(s + t + u), acc)) ([]) (xs));