Commit cb58fb37 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au
Browse files

Add tailU

parent 681ea9ab
......@@ -33,6 +33,7 @@ module Data.Array.Parallel.Unlifted (
-- * Subarrays
sliceU, extractU,
tailU,
takeU, dropU, splitAtU,
{-takeWhileU, dropWhileU, spanU, breakU,-}
......
......@@ -33,6 +33,7 @@ module Data.Array.Parallel.Unlifted.Flat (
-- * Subarrays
sliceU, extractU,
tailU,
takeU, dropU, splitAtU,
{-takeWhileU, dropWhileU, spanU, breakU,-}
......
......@@ -17,13 +17,18 @@
--
module Data.Array.Parallel.Unlifted.Flat.Subarrays (
sliceU, extractU, takeU, dropU, splitAtU,
sliceU, extractU, tailU, takeU, dropU, splitAtU,
{- takeWhileU, dropWhileU, spanU, breakU -}
) where
import Data.Array.Parallel.Stream (
tailS)
import Data.Array.Parallel.Unlifted.Flat.UArr (
UA, UArr,
lengthU, sliceU, newU, copyMU)
import Data.Array.Parallel.Unlifted.Flat.Stream (
streamU, unstreamU)
-- sliceU reexported from UArr
......@@ -31,6 +36,12 @@ import Data.Array.Parallel.Unlifted.Flat.UArr (
extractU :: UA a => UArr a -> Int -> Int -> UArr a
extractU arr i n = newU n $ \marr -> copyMU marr 0 (sliceU arr i n)
-- |Yield the tail of an array
--
tailU :: UA e => UArr e -> UArr e
{-# INLINE tailU #-}
tailU = unstreamU . tailS . streamU
-- |Extract a prefix of an array
--
takeU :: UA e=> Int -> UArr e -> UArr e
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment