3 ms·
I'm not sure that language features making code more succinct really ruin the question. The C# isn't even that succinct compared to doing a similar thing in ot
by A1kmm 13y ago
I'm not sure that language features making code more succinct really ruin the question.
The C# isn't even that succinct compared to doing a similar thing in other popular languages. For example, in Haskell:
topTenWords :: String -> [String]
topTenWords = take 10 . map fst . sortBy (flip (comparing snd)) . map (\l -> (head l, length l)) . group . sort . words
- tome 13y agoflip (comparing whatever) is a neat trick! I'll have to remember that. For \l -> (head l, length l) I tend to use head * * * length (without the spaces between those stars).