Sort an outline at every level: Difference between revisions
Content added Content deleted
(Added Go) |
m (→{{header|Haskell}}: Moved an argument flip upstream) |
||
Line 557: | Line 557: | ||
consistentIndentUnit :: [T.Text] -> Either T.Text T.Text |
consistentIndentUnit :: [T.Text] -> Either T.Text T.Text |
||
consistentIndentUnit prefixes = minimumIndent prefixes >>= |
consistentIndentUnit prefixes = minimumIndent prefixes >>= checked prefixes |
||
where |
where |
||
checked |
checked xs indentUnit |
||
| all ((0 ==) . (`rem` unitLength) . T.length) xs = Right indentUnit |
| all ((0 ==) . (`rem` unitLength) . T.length) xs = Right indentUnit |
||
| otherwise = |
| otherwise = |
||
Line 584: | Line 584: | ||
| x <- textLines |
| x <- textLines |
||
, s <- [T.takeWhile isSpace x] |
, s <- [T.takeWhile isSpace x] |
||
, 0 /= T.length s ] |
, 0 /= T.length s ]</lang> |
||
</lang> |
|||
{{Out}} |
{{Out}} |
||
<pre>Four-spaced (A -> Z): |
<pre>Four-spaced (A -> Z): |