Skip to content

Instantly share code, notes, and snippets.

@ssadler
Created October 5, 2013 15:17
Show Gist options
  • Save ssadler/6842183 to your computer and use it in GitHub Desktop.
Save ssadler/6842183 to your computer and use it in GitHub Desktop.
import Data.List (partition)
sortByOther :: String -> String -> String
sortByOther [] _ = []
sortByOther (x:xs) ins = matches ++ sortByOther xs rejects
where (matches, rejects) = partition (==x) ins
main = putStrLn $ sortByOther "abcd" "ccbbaae"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment