Generic linear-time sorting
Reason this release was yanked:
Incorrect name
Project description
discer
Generic linear-time sorting and partitioning
Based on this paper by Fritz Henglein.
Warning before you start using this library
The standard libraries sorted
function has linear-time sorting in the average case (Timsort) and is way more optimized than this library and will almost certainly be faster than any sorting done with this library.
discer.relations
contains a Relation
type that represents the Order
and Equiv
types from the paper along with a few of standard relations from the paper.
discer.grouping
and discer.sorting
contain the respective Equiv
and Order
based from functions from the paper.
Future work
Not in any particular order:
- Better README and docs
- Add some tests
- Optimize
- Lazy evaluation over the key/pair list to reduces passes on it
- Defer to
sorted
when it will likely (or definitely) run in linear time - The paper includes some optimizations not included
- Generic Multiset Programming may also contain further optimizations
- Setup
SumL
andProductL
to useTypeVarTuple
- Functions to extend Relations
list :: Relation a -> Relation [a]
tuple :: Relation a -> Relation Tuple[a, ...]
dict :: Relation a -> Relation Dict[k, a]
- Refactor
sdisc
anddisc
, the functions are basically exactly the same except how they deal withNatural
- Add compatibility for at least Python 3.8+
References
Henglein, Fritz. "Generic top-down discrimination for sorting and partitioning in linear time." Journal of Functional Programming 22.3 (2012): 300-374.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file discr-0.1.0.tar.gz
.
File metadata
- Download URL: discr-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed7d642413cbd47003cf82cb5e139d07598c0b1260c2c751f2b052a977695a50 |
|
MD5 | 07b9152660e79ffffb7102c920976daf |
|
BLAKE2b-256 | 77d7881e2dd7dabd183974d8bca894673cd5ad611c64e26298e49f69095aa0f5 |
File details
Details for the file discr-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: discr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28384f729edd1d2d47f6d213aece8f834d2bdef19b37dc908d7c0d3d234a64e1 |
|
MD5 | ccca50469ec67c6da9514122b76a56ab |
|
BLAKE2b-256 | adc50d0791004a600f3f9efc710050c3e5f4efc7535ec727174bc5f9d738cd2c |