const f = arr => ( arr.reduce((prev, next) => [ ...prev, ...prev.map(item => [next, ...item]) ], [[]]) )