I hereby claim:
- I am fishcorn on github.
- I am fishcorn (https://keybase.io/fishcorn) on keybase.
- I have a public key whose fingerprint is F8A9 66BE 85F8 02D0 2D29 3047 A3B5 0C02 62A6 53F5
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
-- | Find the element which has @n@ other elements less than or equal | |
-- to it from the input. | |
-- | |
-- NB: works best for unordered inputs. Pivots on the first element, | |
-- so is worst-case quadratic. | |
nthRank :: (Ord a) => Int -> [a] -> Maybe a | |
nthRank _ [] = Nothing | |
nthRank 0 xs = Just $ minimum xs | |
nthRank n xs'@(x:xs) | |
| n < 0 = Nothing |