Generic worst-case-linear-time sorting and partitioning algorithms based on discriminators. Partially a port of the Haskell library of the same name.