2024-05-26 00:36:26 -05:00
|
|
|
import Data.List (sortBy)
|
2024-05-25 19:28:16 -05:00
|
|
|
|
|
|
|
lsort :: [[a]] -> [[a]]
|
|
|
|
lsort = sortBy (\x y -> length x `compare` length y)
|
|
|
|
|
|
|
|
lfsort :: [[a]] -> [[a]]
|
|
|
|
lfsort ls = sortBy (\x y -> count x `compare` count y) ls
|
|
|
|
where
|
|
|
|
count x = length . filter (length x ==) $ map length ls
|