Split a character string based on change of character: Difference between revisions

m
Line 1,247:
 
// group :: [a] -> [[a]]
const group = xs => {
// A list of lists, each containing only
// elements equal under (===), such that the
// concatenation of these lists is xs.
const0 ys< xs.length ? (() => [...xs];{
const [h, ...t] = ysxs;
 
return 0 < ys.length ? (() => {
const [h, ...t] = ys;
const [v, r] = t.reduce(
([gps, a], x) => x === a[0] ? (
Line 1,264 ⟶ 1,262:
return [...v, r];
})() : [];
};
 
// Tuple (,) :: a -> b -> (a, b)
9,655

edits