Skip to content

Instantly share code, notes, and snippets.

@angelworm
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelworm/a64789d087b202fde411 to your computer and use it in GitHub Desktop.
Save angelworm/a64789d087b202fde411 to your computer and use it in GitHub Desktop.
男装の麗人
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