sym-0.9: Permutations, patterns, and statistics

MaintainerAnders Claesson <anders.claesson@gmail.com>
Safe HaskellNone

Data.CLongArray

Contents

Description

Convenience functions for dealing with arrays of CLongs.

Synopsis

Data type

Conversions

fromList :: [Int] -> CLongArraySource

Construct an array from a list of elements.

toList :: CLongArray -> [Int]Source

The list of elements.

slice :: [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.

unsafeSlice :: [Int] -> CLongArray -> [CLongArray]Source

Like slice but without range checking.

Accessors

size :: CLongArray -> IntSource

The size/length of the given array.

at :: CLongArray -> Int -> IntSource

w `at` i is the value of w at i, where i is in [0..size w-1].

unsafeAt :: CLongArray -> Int -> IntSource

Like at but without range checking.

Map

imap :: (Int -> CLong -> CLong) -> CLongArray -> CLongArraySource

Apply a function to every element of an array and its index.

Low level functions

unsafeNew :: Int -> (Ptr CLong -> IO ()) -> IO CLongArraySource

Create a new array of the given size that is initialized through an IO action.

unsafeWith :: CLongArray -> (Ptr CLong -> IO a) -> IO aSource

Pass a pointer to the array to an IO action; the array may not be modified through the pointer.