Sort the letters of string in alphabetical order: Difference between revisions
Sort the letters of string in alphabetical order (view source)
Revision as of 11:03, 25 July 2021
, 2 years ago→{{header|Haskell}}
m (→case insensitive: use internal sort) |
|||
Line 131:
qSort :: (Ord a) => [a] -> [a]
qSort [] = []
qSort (x : xs) = before <>
where
before = qSort [c | c <- xs, c <= x]
after = qSort [c | c <- xs, c > x]
</lang>
{{Out}}
<pre>" ?Iaaaaaaaabbcceeefghhhiiiiiijkllllllmnoopppsssssttt"</pre>
|