Copyright | Anders Claesson 2013-2016 |
---|---|
Maintainer | Anders Claesson <anders.claesson@gmail.com> |
Safe Haskell | None |
Language | Haskell98 |
Convenience functions for dealing with arrays of CLong
s.
- data CLongArray
- fromList :: [Int] -> CLongArray
- toList :: CLongArray -> [Int]
- slices :: [Int] -> CLongArray -> [CLongArray]
- size :: Size a => a -> Int
- at :: CLongArray -> Int -> Int
- unsafeAt :: CLongArray -> Int -> Int
- elemIndices :: CLong -> CLongArray -> Vector Int
- imap :: (Int -> CLong -> CLong) -> CLongArray -> CLongArray
- izipWith :: (Int -> CLong -> CLong -> CLong) -> CLongArray -> CLongArray -> CLongArray
- unsafeNew :: Int -> (Ptr CLong -> IO ()) -> IO CLongArray
- unsafeWith :: CLongArray -> (Ptr CLong -> IO a) -> IO a
Data type
data CLongArray Source #
An array of CLong
s
Conversions
fromList :: [Int] -> CLongArray Source #
Construct an array from a list of elements.
toList :: CLongArray -> [Int] Source #
The list of elements.
slices :: [Int] -> CLongArray -> [CLongArray] Source #
Slice a CLongArray
into contiguous segments of the given
sizes. Each segment size must be positive and they must sum to the
size of the array.
Accessors
at :: CLongArray -> Int -> Int infixl 9 Source #
w `at` i
is the value of w
at i
, where i
is in [0..size w-1]
.
elemIndices :: CLong -> CLongArray -> Vector Int Source #
The indices of all elements equal to the query element, in ascending order.
Map
imap :: (Int -> CLong -> CLong) -> CLongArray -> CLongArray Source #
Apply a function to every element of an array and its index.
izipWith :: (Int -> CLong -> CLong -> CLong) -> CLongArray -> CLongArray -> CLongArray Source #
Apply a function to corresponding pairs of elements and their (shared) index.
Low level functions
unsafeNew :: Int -> (Ptr CLong -> IO ()) -> IO CLongArray Source #
Create a new array of the given size that is initialized through an IO action.
unsafeWith :: CLongArray -> (Ptr CLong -> IO a) -> IO a Source #
Pass a pointer to the array to an IO action; the array may not be modified through the pointer.