hakaru-0.1.3: A probabilistic programming embedded DSL

Safe HaskellSafe-Inferred

Language.Hakaru.Util.Extras

Description

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.

Synopsis

Documentation

extract :: Seq a -> Int -> Maybe (Seq a, a)Source

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)

pairs :: [a] -> [(a, a)]Source

l2Norm :: Floating a => [a] -> aSource