Safe Haskell | None |
---|---|

Language | Haskell2010 |

Functions on lists and sequences. Some of the functions follow the style of Data.Random.Extras (from the random-extras package), but are written for use with PRNGs from the "mwc-random" package rather than from the "random-fu" package.

- extract :: Seq a -> Int -> Maybe (Seq a, a)
- randomExtract :: Seq a -> GenIO -> IO (Maybe (Seq a, a))
- randomElems :: Ord a => Seq a -> Int -> IO (Seq a)
- randomElemsTR :: Ord a => Seq a -> Seq a -> GenIO -> Int -> IO (Seq a)
- pieces :: Seq a -> Seq Int -> [Seq a]
- randomPieces :: Int -> Seq a -> IO [Seq a]
- pairs :: [a] -> [(a, a)]
- l2Norm :: Floating a => [a] -> a

# Documentation

randomElems :: Ord a => Seq a -> Int -> IO (Seq a) Source

Given a sequence, return a *sorted* sequence of n randomly selected elements from *distinct positions* in the sequence

pieces :: Seq a -> Seq Int -> [Seq a] Source

Chop a sequence at the given indices. Assume number of indices given < length of sequence to be chopped

randomPieces :: Int -> Seq a -> IO [Seq a] Source

Given n, chop a sequence at m random points where m = min (length-1, n-1)