Safe Haskell | Safe-Inferred |
---|
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 System.Random rather than from the random-fu package.
- extract :: Seq a -> Int -> Maybe (Seq a, a)
- randomExtract :: Seq a -> IO (Maybe (Seq a, a))
- randomElems :: Ord a => Seq a -> Int -> IO (Seq a)
- randomElemsTR :: Ord a => Seq a -> Seq a -> 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
randomExtract :: Seq a -> IO (Maybe (Seq a, a))Source
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
randomElemsTR :: Ord a => Seq a -> Seq a -> Int -> IO (Seq a)Source
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)