Skip to content

Instantly share code, notes, and snippets.

@crclark96
Created October 18, 2021 12:02
Show Gist options
  • Save crclark96/4114dfdfa7fb0a7ee293e6485d995e07 to your computer and use it in GitHub Desktop.
Save crclark96/4114dfdfa7fb0a7ee293e6485d995e07 to your computer and use it in GitHub Desktop.
import Data.List (sortOn)
reorder :: [Char] -> [Int] -> [Char]
reorder a b = map fst . sortOn snd $ zip a b
a = ['C'..'H']
b = [3, 0, 4, 1, 2, 5]
main = putStrLn $ reorder a b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment