tensort-1.0.1.4: Tunable sorting for responsive robustness and beyond
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Tensort.Tensort

Description

This module provides variations of the Tensort algorithm using the custom Sortable type for inputs and outputs

Synopsis

Documentation

tensort :: TensortProps -> Sortable -> Sortable Source #

Sort a Sortable list using a custom Tensort algorithm

Takes TensortProps (Bytesize and SubAlgorithm) and a Sortable and returns a sorted Sortable

Examples

Expand
>>> import Data.Tensort.Subalgorithms.Bubblesort (bubblesort)
>>> import Data.Tensort.Utils.MkTsProps (mkTsProps)
>>> tensort (mkTsProps 2 bubblesort) (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> tensort (mkTsProps 2 bubblesort) (SortRec [(1, 16), (5, 23), (2, 4) ,(3, 8), (0, 15) , (4, 42)])
SortRec [(2,4),(3,8),(0,15),(1,16),(5,23),(4,42)]

tensortB4 :: Sortable -> Sortable Source #

Sort a Sortable list using a Standard Tensort algorithm with a 4-Bit Bytesize

Examples

Expand
>>> tensortB4 (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> tensortB4 (SortRec [(1, 16), (5, 23), (2, 4) ,(3, 8), (0, 15) , (4, 42)])
SortRec [(2,4),(3,8),(0,15),(1,16),(5,23),(4,42)]

tensortBN :: Int -> Sortable -> Sortable Source #

Sort a Sortable list using a Standard Tensort algorithm with a custom Bytesize

Examples

Expand
>>> tensortBN 3 (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> tensortBN 3 (SortRec [(1, 16), (5, 23), (2, 4) ,(3, 8), (0, 15) , (4, 42)])
SortRec [(2,4),(3,8),(0,15),(1,16),(5,23),(4,42)]

tensortBL :: Sortable -> Sortable Source #

Sort a Sortable list using a Standard Logarithmic Tensort algorithm

Standard Logarithmic Tensort uses a Bytesize that approximates the natural logarithm of the length of the input list and a Bubblesort subalgorithm

Examples

Expand
>>> tensortBL (SortBit [16, 23, 4, 8, 15, 42])
SortBit [4,8,15,16,23,42]
>>> tensortBL (SortRec [(1, 16), (5, 23), (2, 4) ,(3, 8), (0, 15) , (4, 42)])
SortRec [(2,4),(3,8),(0,15),(1,16),(5,23),(4,42)]