Longest common prefix: Difference between revisions

Content added Content deleted
Line 1,901: Line 1,901:
// allSame :: [a] -> Bool
// allSame :: [a] -> Bool
const allSame = xs =>
const allSame = xs =>
// True if xs is empty, or every item in the
// 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.
0 === xs.length || (() => {
2 > xs.length || (() => {
const [h, ...t] = xs;
const [h, ...t] = xs;