Created
October 14, 2015 04:52
-
-
Save motokiee/80db477610fee752c8cb to your computer and use it in GitHub Desktop.
ちょっとだけHaskellのモジュールの勉強した。ちょっと面倒な処理をこの少ない行にまとめられるのスゴい #CodePiece
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.List | |
| import qualified Data.Map as M | |
| numUniques :: (Eq a) => [a] -> Int | |
| numUniques = length . nub | |
| wordNums :: String -> [(String,Int)] | |
| wordNums = map (\ws -> (head ws, length ws)) . group . sort . words |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment