Longest common prefix: Difference between revisions
Content added Content deleted
(→JS ES6) |
m (→JS ES6) |
||
Line 1,901: | Line 1,901: | ||
// allSame :: [a] -> Bool |
// allSame :: [a] -> Bool |
||
const allSame = xs => |
const allSame = xs => |
||
// True if xs |
// True if xs has less than 2 items, or every item |
||
// tail of the list is identical to the head. |
// in the tail of the list is identical to the head. |
||
2 > xs.length || (() => { |
|||
const [h, ...t] = xs; |
const [h, ...t] = xs; |
||