Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- chunks :: (Vector u a, Vector v (u a)) => Int -> u a -> v (u a)
- group :: (Eq a, Vector u a, Vector v (u a)) => u a -> v (u a)
- groupBy :: (Vector u a, Vector v (u a)) => (a -> a -> Bool) -> u a -> v (u a)
- tuples2 :: (Vector v a, Vector v (a, a)) => v a -> v (a, a)
- tuples2N :: (Vector v a, Vector v (a, a)) => Int -> v a -> v (a, a)
- tuples3 :: (Vector v a, Vector v (a, a, a)) => v a -> v (a, a, a)
- tuples3N :: (Vector v a, Vector v (a, a, a)) => Int -> v a -> v (a, a, a)
- tuples4 :: (Vector v a, Vector v (a, a, a, a)) => v a -> v (a, a, a, a)
- tuples4N :: (Vector v a, Vector v (a, a, a, a)) => Int -> v a -> v (a, a, a, a)
- transpose :: Vector v a => Int -> Int -> v a -> v a
- nextPermutation :: (MVector mv a, Ord a, PrimMonad m) => mv (PrimState m) a -> m Bool
- prevPermutation :: (MVector mv a, Ord a, PrimMonad m) => mv (PrimState m) a -> m Bool
- kthPermutation :: (MVector mv a, Ord a, PrimMonad m) => mv (PrimState m) a -> Int -> m Bool
Documentation
transpose :: Vector v a => Int -> Int -> v a -> v a Source #
>>>
import qualified Data.Vector.Unboxed as U
>>>
transpose 2 3 (U.fromList "abcdef")
"adbecf"
nextPermutation :: (MVector mv a, Ord a, PrimMonad m) => mv (PrimState m) a -> m Bool Source #
>>>
U.modify (void . nextPermutation) $ U.fromList "abc"
"acb">>>
U.modify (void . nextPermutation) $ U.fromList "cba"
"cba">>>
U.modify (void . nextPermutation) $ U.fromList "a"
"a">>>
U.modify (void . nextPermutation) $ U.fromList ""
""
prevPermutation :: (MVector mv a, Ord a, PrimMonad m) => mv (PrimState m) a -> m Bool Source #
>>>
U.modify (void . prevPermutation) $ U.fromList "acb"
"abc">>>
U.modify (void . prevPermutation) $ U.fromList "abc"
"abc">>>
U.modify (void . prevPermutation) $ U.fromList "a"
"a">>>
U.modify (void . prevPermutation) $ U.fromList ""
""
kthPermutation :: (MVector mv a, Ord a, PrimMonad m) => mv (PrimState m) a -> Int -> m Bool Source #
>>>
U.modify (void . flip kthPermutation (120 - 1)) $ U.fromList "abcde"
"edcba">>>
U.modify (void . flip kthPermutation 0) $ U.fromList "abcde"
"abcde">>>
U.modify (void . flip kthPermutation 1) $ U.fromList "abcde"
"abced">>>
U.modify (void . flip kthPermutation 999) $ U.fromList "abcde"
"abcde"