-
-
Save angelworm/a64789d087b202fde411 to your computer and use it in GitHub Desktop.
男装の麗人
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char | |
import Data.List | |
import Data.Function | |
import Data.Monoid | |
comp::String->String->Ordering | |
comp (as@(a:ax)) (bs@(b:bx)) | |
| isNumber a && isNumber b = | |
ncomp as bs <> (comp `on` dropWhile isNumber) as bs | |
| otherwise = compare a b <> comp ax bx | |
where | |
ncomp = compare `on` ((read::String->Int) . takeWhile isNumber) | |
comp (_:_) [] = GT | |
comp [] (_:_) = LT | |
comp [] [] = EQ | |
fnsort::[String]->[String] | |
fnsort = sortBy comp | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment