Skip to content

Instantly share code, notes, and snippets.

@jrm2k6
Created January 17, 2014 01:15
Show Gist options
  • Select an option

  • Save jrm2k6/8466759 to your computer and use it in GitHub Desktop.

Select an option

Save jrm2k6/8466759 to your computer and use it in GitHub Desktop.
-- problem 28
compareLength::(Int, [a]) ->(Int, [a]) -> Ordering
compareLength a1 a2 = if (fst a1 > fst a2) then GT else LT
lsort :: [[a]] -> [[a]]
lsort l = map (\x -> (snd x) ) $ sortBy compareLength $ map (\x -> (length x, x)) l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment