```javascript const cat = (head, ...items) => head.length ? head.concat.apply(head, items) : []; const flat = arr => Array.isArray(arr) ? cat.apply(cat, arr.map(flat)) : [arr]; ```